我有一个包含多个值的数组,我想比较一些值是否相等,如果有多于1等于它,则将值放在一个新数组中
示例:
for(var i=0; i<res.data.diaries.length;i++){
var values = res.data.diaries[i].diary.symptoms;
if( typeof values.whichSymptoms !== 'undefined' ) {
// foo could get resolved and it's defined
for(var j= 0; j<values.whichSymptoms.length;j++){
//console.log(values.whichSymptoms[j].text);
var whichSymptoms = values.whichSymptoms[j];
console.log(whichSymptoms);
//// ToDo Check values if equal and put that in an array.
}
}
}
答案 0 :(得分:0)