What Is an Array?
An array is a way to store a collection of multiple items under a single variable name. This section introduces how to create, delete and access array elements. Think about the following as you read the article:
- How are array elements accessed?
- What methods are used to access the elements of an array?
- How would you convert a string into an array?
Accessing every item
Very often you will want to access every item in the array. You can do this using the for...of
statement:
const birds = ["Parrot", "Falcon", "Owl"]; for (const bird of birds) { console.log(bird); }