for in javascript

JavaScript
var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) { 
  console.log(colors[i]);
}let str = "";

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

console.log(str);
// expected output: "012345678"
const object = {a: 1, b: 2, c: 3};

for (const property in object) {
  console.log(`${property}: ${object[property]}`);
}

// expected output:
// "a: 1"
// "b: 2"
// "c: 3"
for (let i = start; i < end; i++) {

}let items = ['beef', 'cabbage', 'javascript']; // Defines a list of items
for (let item of items) { // Defines for loop with a variable of 'item'
  console.log(item); // Prints the item that is found
}const object = { a: 1, b: 2, c: 3 };

for (const property in object) {
  console.log(`${property}: ${object[property]}`);
}

// expected output:
// "a: 1"
// "b: 2"
// "c: 3"

Source

Also in JavaScript: