Answers for "array en javascript"

140

javascript array

//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]);
}
Posted by: Guest on July-01-2019
-2

javascript array

window.location.href
Posted by: Guest on December-12-2020
9

js array

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 :)
Posted by: Guest on June-21-2020
1

javascript array

//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)];
//then we can console.log the random word from the array
console.log(logammounts[woodloot])
Posted by: Guest on February-27-2021
0

javascript array

//array methods
https://stackoverflow.com/questions/351409/how-to-append-something-to-an-array
Posted by: Guest on August-06-2021
0

java script arrays

fruits = ["Banana", "Orange", "Apple", "Mango"];
text = "<ul>";
for (i = 0; i < fruits.length; i++) {
  text += "<li>" + fruits[i] + "</li>";
}
Posted by: Guest on March-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language