//create an array:
let colors = ["red","blue","green"];
//you can loop through an array like this:
//For each color of the Array Colors
for (color of colors){
console.log(color);
}
//or you can loop through an array using the index:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
var colors = [ "red", "orange", "yellow", "green", "blue" ]; //Array
console.log(colors); //Should give the whole array
console.log(colors[0]); //should say "red"
console.log(colors[1]); //should say "orange"
console.log(colors[4]); //should say "blue"
colors[4] = "dark blue" //changes "blue" value to "dark blue"
console.log(colors[4]); //should say "dark blue"
//I hope this helped :)
//An array is a list of thing, you can add as many things as you want
var food = ["cake", "apple", "Ice-Cream"]
//You can use Math.Random to pick a random number
//from one to the length of the array
var Number = [Math.floor(Math.random() * food.length)]; // get a random number
//then we can console.log the random word from the array
console.log(logammounts[woodloot])
//You can also create an array, then provide the elements:
Example
const food = [];
food[0]= "cake";
food[1]= "apple";
food[2]= "Ice-Cream";
//create an array like so:
var colors = ["red"];
//can add an element to array like this:
colors.push("blue");
//loop through an array like this:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}