JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://nervgh.github.io/js/recursive-iterator.min.js"></script>
JavaScript
// https://github.com/nervgh/recursive-iterator
'use strict';
let obj = {
a: {
b: [],
c: []
},
d: {
e: ['test'],
f: [],
g: []
}
};
for(let {node, key, path} of new RecursiveIterator(obj)) {
console.log(path.join('.'));
console.log(key, node);
console.log('-------');
}