Skip to content

Instantly share code, notes, and snippets.

@wmfairuz
Last active February 22, 2016 20:03
Show Gist options
  • Save wmfairuz/0862e22f1dfcc074e111 to your computer and use it in GitHub Desktop.
Save wmfairuz/0862e22f1dfcc074e111 to your computer and use it in GitHub Desktop.
function abc(z) { for(y in z) { console.log(y, typeof z[y], z[y]); if(typeof z[y] === 'object') { abc(z[y]); } } }
function abc(z, prop) { for(y in z) { if(typeof prop === 'undefined') { console.log(y, typeof z[y], z[y]); } else { if(y === prop) { console.log('FOUND'); } } if(typeof z[y] === 'object') { abc(z[y], prop); } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment