Answers for "javascript for loop create array"

48

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
13

loop through an array javascript

let array = ['Item 1', 'Item 2', 'Item 3'];

// Here's 4 different ways
for (let index = 0; index < array.length; index++) {
  console.log(array[index]);
}

for (let index in array) {
  console.log(array[index]);
}

for (let value of array) {
  console.log(value); // Will log value in array
}

array.forEach((value, index) => {
  console.log(index); // Will log each index
  console.log(value); // Will log each value
});
Posted by: Guest on March-25-2020
3

javascript loop array

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Posted by: Guest on December-13-2019
-1

javascript loop aray

Shinjima no soko kara. Joe Joe reference boys? Anyone get it? Also hi, I-Monkey. You like tomatoes? Me neither.
                ur gay
Posted by: Guest on May-06-2021

Code answers related to "javascript for loop create array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language