Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. /* Define a JavaScript Object */
  2. var person = { name: 'Maxwell', age: 20, married: false };
  3.  
  4. /* for - in Loop */
  5. for (var property in person) {
  6. console.log(property + ' of the person is ' + person[property]);
  7. }
  8. // => "name of the person is Maxwell"
  9. // => "age of the person is 20"
  10. // => "married of the person is false"
  11.  
  12. /* for - of Loop */
  13. for (var value of person) {
  14. console.log('Current value is ' + value + '.');
  15. }
  16. // => "Current value is Maxwell"
  17. // => "Current value is 20"
  18. // => "Current value is false"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement