0
在我的骨幹收集,這是模型數據我有:無法獲取模型屬性比較結果
var student = [
{name:"student0",scored:75},
{name:"student1",scored:49},
{name:"student2",scored:25}
]
從模型數據(集合),我試圖得到「拿下」屬性更60 ... 要做到這一點我用這個方法,
上點擊我打電話了一個名爲「showHighScore」的方法,
getHighSocre:function(){
return _.each(this.collection.models, function(item){
return parseInt(item.get('scored')) > 60
})
},
showHighScore:function(){
var highscore = this.getHighSocre();
console.log(highscore);//i am getting the result as undifined
}
時被稱爲「showHighScore」,我循環並返回值,但控制檯給我一個結果爲'未定義'..這是錯誤的方式..或者什麼是正確的方式來獲得具有屬性「得分」60以上的模型集合......
任何人都可以幫助我..在此先感謝。