var_dump in JavaScript


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



Copy this code and paste it in your HTML
  1. function dump(obj) {
  2. var out = '';
  3. if(obj && typeof(obj) == 'object'){
  4. for (var i in obj) {
  5. out += i + ": " + obj[i] + "\n";
  6. }
  7. } else {
  8. out = obj;
  9. }
  10. alert(out);
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.