for..in is used to iterate through the properties in our javascript objects.
The syntax
for (variable in object) {
//do something with the variable
}
Example
"use strict"
var obj = {a:1, b:2, c:3};
for (var prop in obj) {
console.log("obj." + prop + " = " + obj[prop]);
}
// Output:
// "obj.a = 1"
// "obj.b = 2"
// "obj.c = 3"
You may also use the for..in without using the var keyword if you do no have “use strict” at the top.