December 2013
Intermediate to advanced
384 pages
9h 54m
English
var obj = {first:"Bilbo", last:"Baggins", title:"Hobbit"}; for (var key in obj){ document.write(key + "=" + obj[key] + "&"); }
JavaScript provides an additional type of option in the for() loop. Using the in keyword, you can iterate through the values in an array or the properties in an object. The syntax is for( var name in object){LOOP_BLOCK}. The name is assigned the property name inside the LOOP_BLOCK.
Read now
Unlock full access