Last active
January 5, 2021 16:44
-
-
Save Jagathishrex/17997fa902426ad10da78bea1290ec03 to your computer and use it in GitHub Desktop.
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
// print key-values of an object recursively | |
function flattenObject(obj) { | |
for (let key in obj) { | |
if (typeof obj[key] === 'string') { | |
console.log(key, obj[key]); | |
} | |
if (typeof obj[key] === 'object') { | |
flattenObject(obj[key]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment