×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Nilesh Yadav
Added: Jul 3, 2017 5:47 PM
Views: 4
Tags: no tags
  1. var person = {first_name: 'Dwayne', last_name: 'Charrington', age: 27, star_sign: 'Aquarius'};
  2.  
  3. // The below loop will output:
  4. // "Dwayne"
  5. // "Charrington"
  6. // 27
  7. // "Aquarius"
  8.  
  9. for (var p in person) {
  10.     if (person.hasOwnProperty(p)) {
  11.         console.log(person[p]);
  12.     }
  13. }