Different types of arrays CODE
Creates array of numbers;
let myFavoriteNumbers = [5, 14, 16, 27]
Creates array of strings
let myFavoriteColors = ['green', 'yellow', 'red']
Creates array of arrays
let myMatrix = [
    [12, 23, 34], 
    [13, 35, 57], 
    [14, 47, 70], 
]
Creates array of objects
let myFavoritePlanets = [
    {name: 'Earth', radius: 6371}, 
    {name: 'Jupiter', radius: 69911}, 
    {name: 'Neptune', radius: 24622, moons: ['Triton', 'Thalassa', 'Nereid', 'Proteus', 'Hippocamp', 'Naiad']}
]
Accessing one of the moons of Neptune
console.log(myFavoritePlanets[2].moons[4])
by Valeri Tandilashvili
4 years ago
JavaScript
Arrays
1
Pro tip: use ```triple backticks around text``` to write in code fences