To iterate through a Javascript object you can use this syntax:
Code Block | ||
---|---|---|
| ||
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:
...