for in loop in javacript 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]}`);
}
// expected output:
// "a: 1"
// "b: 2"
// "c: 3"
Example 2: for loop in js
for (let counter = 1; counter < 3; counter++) {
// console.log(counter,'\n');
}