Array is a special type of object which contains ordered list of values.
Key of an array is indexed it starts from 0 and for each new element it keeps incrementing (0, 1, 2, 3, ......) it is defined by the JavaScript
Creating an Array
Empty object
let array = [];
Array of numbers
let numbers = [12, 45, 49, 53];
Array of strings
let fruits = ["Apple", "Banana", "Mango"];
Mixed Array
let mixed = ['Hello!', true, undefined, 21];
Example:
Declaration of an array
To declare an array you need to specify the array name with the elements in it.
let fruits = ["Apple", "Banana", "Mango"];
Accessing
fruits[0]
Adding
fruits [3] = "Watermelon"
Updating
fruits[1] = "Papaya"
Deleting
delete fruits[2]
Lenths:
Every array has special property called length which gives you the no. of elements in that array.