function getOutdated(robots, newVersion) {
var element = "[object Object]*";
var indices = [];
for(var i = 0; i < robots.length; i++){
if(robots[i].core_version< newVersion){
robots[i]+='*';
}
}
var idx = robots.indexOf(element);
while (idx != -1) {
indices.push(idx);
idx = robots.indexOf(element, idx + 1);
}
console.log(indices);
}
getOutdated ([{"core_version":4},{"core_version":7},{"core_versi on":18},{"core_version":3},{"core_version":15},{"c ore_version":8},{"core_version":5},{"core_version" :6}], 18);
|