Answers for "js create array from for loop"

45

js loop array

var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}
Posted by: Guest on July-22-2019
8

loop array javascript

var colors = ['red', 'green', 'blue'];
	
	colors.forEach((color, colorIndex) => {
     console.log(colorIndex + ". " + color); 
    });
Posted by: Guest on April-08-2020
-1

loop array in javascript

var colors = ["red", "green", "blue"];
for(var i = 0; i < colors.length; i++){
	console.log(colors[i]);
}
Posted by: Guest on October-01-2020
1

js create array from for loop

var yearStart = 2000;
var yearEnd = 2040;

var arr = [];

for (var i = yearStart; i < yearEnd+1; i++) {
    arr.push(i);
}
Posted by: Guest on February-18-2021
0

javascript loop aray

const myArray = [6, 19, 20];const yourArray = [19, 81, 2];for (let i = 0; i < myArray.length; i++) {  for (let j = 0; j < yourArray.length; j++) {    if (myArray[i] === yourArray[j]) {      console.log('Both loops have the number: ' + yourArray[j])    }  }};
Posted by: Guest on May-02-2021
0

javascript loop aray

im fucking gay
Posted by: Guest on May-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language