for in loop javascript mdn code example
Example 1: javascript loop through object
for (var property in object) {
if (object.hasOwnProperty(property)) {
// Do things here
}
}
Example 2: for in loop javascript
var person = {"name":"taylor","age":31};
for (property in person) {
console.log(property,person[property]);
}
//name taylor
//age 31
Example 3: javascript loop
var colors=["red","blue","green"];
for(let color of colors){
console.log(color)
}