I am not sure how to understand this foo property and array here. it looks like foo property got assigned to array, but I don't think it is even valid array syntax. Can someone explain the concept here?
var arr = ; arr = 'a'; arr = 'b'; arr.foo = 'c'; console.log(arr) // ['a','b',foo:'c'] This isn't valid array, but Chrome doesn't show any error. console.log(arr.foo) // 'c'. console.log(arr.length); // 2, not 3
length property, so yes, you can assign random properties to them.
(If you run such an array through JSON, those extra properties will be lost.)