最佳答案
When pushing an array's contents to another array I get
"Uncaught TypeError: Cannot read property 'push' of undefined" error in this snippet.
var order = new Object(), stack = [];
for(var i=0;i<a.length;i++){
if(parseInt(a[i].daysleft) == 0){ order[0].push(a[i]); }
if(parseInt(a[i].daysleft) > 0){ order[1].push(a[i]); }
if(parseInt(a[i].daysleft) < 0){ order[2].push(a[i]); }
}
Why do I get this error in the second if statement ? Thanks a lot!