Last active
September 7, 2016 08:55
-
-
Save Cojad/fc946748f9efdb419827707507459ba2 to your computer and use it in GitHub Desktop.
list hierarchy javascript object values
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
child = function(obj,name){ | |
for( var index in obj){ | |
switch(typeof obj[index]) { | |
case "object": child(obj[index],name+"."+index);break; | |
case "string": console.log(name+"."+index+" = \"" + obj[index] + "\"");break; | |
case "number": console.log(name+"."+index+" = " + obj[index]);break; | |
case "boolean": console.log(name+"."+index+" = \""+ (obj[index]) ? "true":"false" + "\"");break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment