Answers for "javascript loop for"

220

javascript for loop

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

javascript for

let str = "";

for (let i = 0; i < 9; i++) {
  str = str + i;
}

console.log(str);
// expected output: "012345678"
Posted by: Guest on February-16-2020
15

javascript for loop

for (let count = 0; count < 90; count++) {
	// ...
}
Posted by: Guest on September-29-2020
15

loop javascript

for(let i = 0; i < arr.length; i++){

}
Posted by: Guest on March-02-2021
9

for of loop javascript

const array1 = ['a', 'b', 'c'];

for (const element of array1) {
  console.log(element);
}

// expected output: "a"
// expected output: "b"
// expected output: "c"
Posted by: Guest on March-02-2020
8

for loop javascript

var listItem = [
        {name: 'myName1', gender: 'male'},
        {name: 'myName2', gender: 'female'},
        {name: 'myName3', gender: 'male'},
        {name: 'myName4', gender: 'female'},
      ]

    for (const iterator of listItem) {
        console.log(iterator.name+ ' and '+ iterator.gender);
    }
Posted by: Guest on May-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language