Could someone explain this block of code to me and what the type of 'arr' is. I know that an array is an object but
- Why does the [[Class]] show up as Array if it behaves like an Object
arr.length returns 3. How?
var arr = [0, 1, 3]; arr.name = "asdf"; console.log(arr[1] + " " + arr.name + " " + arr.length); // Returns-> 1 asdf 3 Object.prototype.toString.call(arr); // Returns-> "[object Array]"
Whats the deal here?
This has already been answered in good detail in this SO post