HTML CSS JavaScript SEO Python Posts Privacy About Contact

JS Array Methods

Arrays provide a lot of built-in methods.

Arrays provide a lot of built-in methods.

JavaScript Array length

The length property returns the length (size) of an array.

Preview

JavaScript Array toString()

The JavaScript method toString() converts an array to a string of (comma separated) array values.

Preview

Popping and Pushing

When you work with arrays, it is easy to remove elements and add new elements. This is what popping and pushing is: Popping items out of an array, or pushing items into an array.

Preview

Shifting Elements

Shifting is equivalent to popping, working on the first element instead of the last. The shift() method removes the first array element and “shifts” all other elements to a lower index.

Preview