JS - For Each property

by Adam Kinnucane

JavaScript

var colourinfo = { "red":1, "green":5 , "blue":7 }; // define an object to store information

for (var propertyname in colourinfo ){
	var propertyvalue = colourinfo[propertyname];
	alert( propertyname + " = " + propertyvalue ); // this will show each colour one at a time with the value
}