Answers for "javascript build array from loop"

1

loop an array in javascript

let array = ["loop", "this", "array"]; // input array variable
for (let i = 0; i < array.length; i++) { // iteration over input
	console.log(array[i]); // logs the elements from the current input
}
Posted by: Guest on May-18-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

Code answers related to "javascript build array from loop"

Code answers related to "Javascript"

Browse Popular Code Answers by Language