Iterate over properties of and object


/ Published in: JavaScript
Save to your folder(s)

Iterate over the properties of an object


Copy this code and paste it in your HTML
  1. var object =
  2. {
  3. a:10;
  4. b:20;
  5. s:'hello'
  6. };
  7.  
  8.  
  9. $.each(object, function(name, value)
  10. {
  11. console.log(name+':'+value);
  12. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.