Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To iterate through a Javascript object you can use this syntax:

Code Block
languagejs
var CARmodelsCARinfo={
   type :"Fiat", 
   model:"500", 
   color:"white"
}; 

for (var CarInfo in CARmodelsCARinfo) {
  console.log(CarInfo, CARmodelsCARinfo[CarInfo]);
}

This would give the following output at the Javascript console:

...