Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Traverse object graph pure vanilla javascript
const traverse = (obj) => {
for (let k in obj) {
if (obj[k] && typeof obj[k] === 'object') {
traverse(obj[k])
} else {
// Do something with obj[k]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.