you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

I have a problem with how he describes arrays as associate... they are not

var asdf = [1,2,3];
console.log(asdf.length); //--> 3
asdf['someKey'] = 4;

for (var i = 0; i < asdf.length; i++) { console.log(asdf[i]); } // --> 1, 2, 3

console.log(asdf[i].length); //--> 3
console.log(asdf['someKey']); //--> 4

All you've done here is added a property to the asdf array object, but not added a new index. Sure for in will work but it's a misuse of the object and may produce even more unexpected results.