Difference between revisions of "Defining Objects"

From rbachwiki
Jump to navigation Jump to search
(Created page with "<pre> var comptype = { brand: 'ibm', ram: '128 Gigs', hdrive: '1 Terabyte' } </pre> ===Loop through items== for(var item in comptype){ console.log(item + " - " + compty...")
 
Line 7: Line 7:
}
}
</pre>
</pre>
===Loop through items==
===Loop through items===
  for(var item in comptype){
  for(var item in comptype){
  console.log(item + " - " + comptype[item]);
  console.log(item + " - " + comptype[item]);

Revision as of 15:48, 21 October 2016

 var comptype = {
 brand: 'ibm',
 ram: '128 Gigs',
 hdrive: '1 Terabyte'

}

Loop through items

for(var item in comptype){
console.log(item + " - " + comptype[item]);