for in javascript code example
Example 1: for in javascript
const object = {a: 1, b: 2, c: 3};
for (const property in object) {
console.log(`${property}: ${object[property]}`);
}
Example 2: for in javascript
for (let i = start; i < end; i++) {
}
Example 3: for in javascript
let items = ['beef', 'cabbage', 'javascript'];
for (let item of items) {
console.log(item);
}
Example 4: for in javascript
const object = { a: 1, b: 2, c: 3 };
for (const property in object) {
console.log(`${property}: ${object[property]}`);
}
Example 5: for in javascript
var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Example 6: for in javascript
var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) {
console.log(colors[i]);
}