/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function lookdeep(obj){
var A= [], tem;
for(var p in obj){
if(obj.hasOwnProperty(p)){
tem= obj[p];
if(tem && typeof tem=='object'){
A[A.length]= p+':{ '+arguments.callee(tem).join(', ')+'}';
}
else A[A.length]= [p+':'+tem.toString()];
}
}
return A;
}
var O={a: 1, b: 2, c:{c1: 3, c2: 4, c3:{t:true, f:false}},d: 11};
var s=lookdeep(O).join('\n');
console.log(s);
//Will display
/*
a:1
b:2
c:{ c1:3, c2:4, c3:{ t:true, f:false}}
d:11
*/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                