"for in" loop is almost similar to a for loop. It is better to use for in loop especially while retrieving data present in objects.

for in loop Example 1:

while executing the for in loop, variable i will get index numbers of languages array in sequence.
var languages= ['c#','java','javascript','c'];
for (i in languages) {
languages[i] ='hello '+languages[i];

for in loop Example 2:

var doctor= { name:"dr.Rajeev",qualification:"mbbs",age:39 };
for (v in doctor) {