array in javascript

//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]);
}var cars = ["Saab", "Volvo", "BMW"];
 //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"
];// Initializing while declaring 
// Creates an array having elements 10, 20, 30, 40, 50 
var house = new Array(10, 20, 30, 40, 50); 
  
//Creates an array of 5 undefined elements 
var house1 = new Array(5); 
  
//Creates an array with element 1BHK 
var home = new Array("!BHK"); 
//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]
}var cars = [

  "Saab",

    "Volvo",

    "BMW"

];