- In javascript arrays use numbered indexes. They don't have named indexes because javascript does not support associative arrays.
- In javascript object use name indexes.
- You should use objects when you want the element names to be strings (text).
- You should use arrays when you want the element names to be numbers.
Avoid new Array()
There is no need to use the JavaScript's built-in array constructor new Array().
Use [] instead.
These two different statements both create a new empty array named points:
var marks = new Array(); // Bad
var marks = []; // Good