Array

An array is a data structure that holds a collection of items, such as numbers or strings. It allows you to store multiple values in a single variable.

Arrays are indexed, meaning each item has a position (index) that starts from zero. For example, in a list of colors:

[
  "Red",
  "Green",
  "Blue"
]

Here, “Red” is at index 0, “Green” is at index 1, and “Blue” is at index 2. You can access any color by its index.

You could also have an array of numbers like this:

[
  10,
  20,
  30,
  40
]

Arrays are useful for managing lists of data efficiently, allowing for easy access and manipulation of items based on their index.