Answers for "javascrip array"

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

js array

//create an array
let numbers = [ 11 , 13 , 15 , 17]

//you can use loop like this
for(let i = 0;i<numbers.length;i++) {
	console.log(numbers[i])
}
Posted by: Guest on April-17-2021
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

array

array 7
Posted by: Guest on May-03-2021
1

functions in arrays javascript

var argsContainer = ['hello', 'you', 'there'];
var functionsContainer = [];

for (var i = 0; i < argsContainer.length; i++) {
var currentArg = argsContainer[i]; 

  functionsContainer.push(function(currentArg){
    console.log(currentArg);
  });
};

for (var i = 0; i < functionsContainer.length; i++) {
  functionsContainer[i](argsContainer[i]);
}
Posted by: Guest on July-29-2020
0

array

SHOW FULL TABLES
Posted by: Guest on August-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language