Advertisement
Guest User

Untitled

a guest
May 13th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function print(obj) {
  2.     var identation = "";
  3.  
  4.     (function printFunction(obj) {
  5.         if (typeof obj != "object") {
  6.             console.log(identation + obj);
  7.         }
  8.  
  9.         for (var property in obj) {
  10.             if (obj.hasOwnProperty(property)) {
  11.                 console.log(identation + property + ":");
  12.                 identation += "--";
  13.                 printFunction(obj[property]);
  14.                 identation = identation.substr(0, identation.length - 2);
  15.             }
  16.         }
  17.     })(obj);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement