Arrays and array-like objects

Overview

This module covers both arrays and various array-like objects that are used extensively in JavaScript in manipulating the DOMAn object-oriented representation of a web page..

If you are already comfortable with the programming concept of arrays or sequences, please proceed to the next step.

In-depth background from our introductory programming course

Brief review of programming concepts: arrays

Just like a string is a sequence of characters, it is possible to store a sequence of numbers, strings, or other types of data. Each individual value in a sequence is an item or element, and can be accessed by its indexThe position of a value in an array or string. or positionThe position of a value in an array or string.. Positions are usually numbered starting from zero.

Sequences that are mutableData that can change. can be changed, for example, by adding or deleting elements.

A function with a sequence as input might create a new sequence or change the input sequence.

Mutation can lead to aliasing, a situation in which two different names are used for the same data.