What's wrong with my code shown below. It doesn't work on IE 8 or lower.
How can I change it with plain for
loop instead of forEach
?
var mainItems = [];
[100305, 1003403, 1003511, 1003360, 1002328].forEach(function(id) {
//mainItems.forEach(function(id) {
mainItems.push(items.filter(function(elem) {
return elem.id == id;
})[0])
})