javascript array

JavaScript
let fruits = ['Apple', 'Banana']

console.log(fruits.length)
// 2
var cars = ["Saab", "Volvo", "BMW"];
 //create array
var things = ["banana", "car", "computer"];
//access array(starts at 0)
things[0]
//iterate through an array
for (var i = 0; i < things.length; i++) {
  things[i]
}let first = fruits[0]
// Apple

let last = fruits[fruits.length - 1]
// Banana
//single array declaration
var car1 = "Saab";
var car2 = "Volvo";
var car3 = "BMW";

//one line
var cars = ["Toyota", "Jeep", "BMW"];

//multiple lines
var cars = [
 "Toyota",
 "Jeep",
 "BMW"
];//create an array like so:
var colors = ["red","blue","green"];

//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}
Source

Also in JavaScript: