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}
1var fireRefTeacher = firebase.database().ref("object");
2
3
4
5fireRefTeacher.once("value", function(snapshot){
6 snapshot.forEach(function(element){
7
8 var subjects = element.val().TheNestedObject;
9
10
11 var modules = Object.values(subjects);
12
13
14 document.querySelector('#theid').innerHTML +=
15 `
16
17 <li id="letitbe"><span id="spana">${element.val().theValue} ${element.val().theValue}</span><small style="margin-left: 10px;">${modules}</small></li>
18`
19
20 ;
21
22
23 })
24})