Posted By

sottenad on 08/11/10


Tagged

javascript object print alert for each


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

sottenad
isholgueras


Print Object


 / Published in: JavaScript
 

This will loop through an object and display the contents. Very useful when troublshooting JSON or other complex objects in javascript.

  1. function printObject(o){
  2. var output = '';
  3. for (property in o) {
  4. output += property + ': ' + o[property]+'; ';
  5. }
  6. alert(output);
  7. }

Report this snippet  

You need to login to post a comment.