Having an issue with object iteration in my code. It seems that I am only getting the last value when iterating over the object. Can't figure out what's going wrong here!
var index = {};
var demoObj = [{
0:{obj1: {...}, obj2: {...}, obj3: {...}}
},
{
1:{obj1: {...}, obj2: {...}, obj3: {...}}
}];
for (var i = 1; i <= demoObj.length; ++i) {
index[i] = demoObj[i] ;
}
console.log(index);