- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Arrays
JavaScript Arrays
JavaScript Arrays
A JavaScript array stores several values in a single variable.
Instead of one variable for each value, an array holds a whole list under one name.
Each value in the list is called an element.
Example
Example
javascript
const fruits = ["Apple", "Banana", "Mango"];
console.log(fruits.length);The array holds three values.
The output is 3.
What is an Array?
An array is an ordered list of values written inside square brackets.
The order is kept, so the first value stays first.
