I am have a problem that I am not able to push the object into the nested array. Please help thank you!
Here is my code:
let obList = [
{ date: '12/1/2011', reading: 3, id: 2055 },
{ date: '13/1/2011', reading: 5, id: 2053 },
{ date: '14/1/2011', reading: 6, id: 1652 },
{ date: '14/1/2011', reading: 6, id: 152 },
{ date: '14/1/2011', reading: 6, id: 1562 },
{ date: '14/1/2011', reading: 6, id: 2662 },
{ date: '14/1/2011', reading: 6, id: 3652 }
];
let lit = ["Saab", "Volvo", "BMW"];
let mainList = [[],[]]
for (let i = 0; i < 2; i++){
obList.forEach(el=>{
console.log(el.id >= 2000)
if(obList.id >= 2000){
mainList[i].push("ss")
}
})
}
console.log(mainList)
The output for the mainList is empty
[ [], [] ]
filterinstead?