1function nestedLoop(obj) {
2 const res = {};
3 function recurse(obj, current) {
4 for (const key in obj) {
5 let value = obj[key];
6 if(value != undefined) {
7 if (value && typeof value === 'object') {
8 recurse(value, key);
9 } else {
10 // Do your stuff here to var value
11 res[key] = value;
12 }
13 }
14 }
15 }
16 recurse(obj);
17 return res;
18}