Tuesday, 11 March 2014

For-In Loop in JavaScript

Iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.
The JavaScript for/in statement loops through the properties of an object:
var txt="";
var person={fname:"John",lname:"Doe",age:25}; 

for (var x in person)
  txt=txt + person[x];



No comments:

Post a Comment