I am having this error in sorting the id I get from json array.
This is the code:
for (var i = 0, len = myArr.Items.length; i < len; i++) {
var id_art = myArr.Items[i].id_a;
if (id_art == id_url) {
results[i] = myArr.Items[i];
results[i].sort(function (a, b) {
if (a.results[i].id != b.results[i].id) {
return (a.results[i].id - b.results[i].id);
}
});
}
}
console.log(results);
How can I fix it?