Created
September 20, 2012 02:28
-
-
Save pec1985/3753611 to your computer and use it in GitHub Desktop.
Javscript getProps function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getProps(obj, indent) { | |
indent = indent || 0; | |
for(var key in obj) { | |
var str = ''; | |
for(var i = 0; i < indent; i++) str += '----'; | |
console.log(str + key + ' : ' + typeof obj[key]); | |
if(typeof obj[key] == 'object') { | |
getProps(obj[key], indent + 1) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment