2016-08-16

In JavaScript, an Array isn't like your typical array: it's an object with keys that are indexes. What this means is that you need to be aware that the length can be more than the number of elements and that there can be "holes".

The Array Constructor

In day-to-day development you'll probably just build up arrays using the literal syntax, like so:
var myArray = ['An element', 'Another']

However, there is a constructor for Array that initializes the length:
// Initialize an array with a le...

Show more