|
40 | 40 | } |
41 | 41 | } |
42 | 42 | }; |
43 | | - |
44 | | - |
45 | | - /*for(const prop in data) { |
46 | | - let li = document.createElement('li'); |
47 | | - console.log('-----nivel 1-----'); |
48 | | - console.log(`${prop} : ${data[prop]}`); |
49 | | - for(const prop2 in data[prop]) { |
50 | | - console.log('-----nivel 2-----'); |
51 | | - console.log(`${prop2} : ${data[prop][prop2]}`); |
52 | | - for(const prop3 in data[prop][prop2]) { |
53 | | - console.log('-----nivel 3-----'); |
54 | | - console.log(`${prop3} : ${data[prop][prop2][prop3]}`); |
55 | | - for(const prop4 in data[prop][prop2][prop3]) { |
56 | | - console.log('-----nivel 4-----'); |
57 | | - console.log(`${prop4} : ${data[prop][prop2][prop3][prop4]}`); |
58 | | - } |
59 | | - } |
60 | | - } |
61 | | - } |
62 | | - */ |
63 | | - |
64 | | - |
65 | | - /*function createTree(container, data) { |
66 | | - let ul = document.createElement('ul'); |
67 | | - for(const prop in data) { |
68 | | - console.log(`${prop} : ${data[prop]}`); |
69 | | - let li = document.createElement('li'); |
70 | | - li.textContent = prop; |
71 | | - ul.append(li); |
72 | | - } |
73 | | - container.append(ul); |
74 | | - } |
75 | | -
|
76 | | - createTree(tree, data); |
77 | | - createTree(document.querySelector('ul').firstElementChild, data.Fish); |
78 | | - createTree(document.querySelector('ul').lastElementChild, data.Tree); |
79 | | - createTree(document.querySelector('ul').lastElementChild.firstElementChild.firstElementChild, data.Tree.Huge); |
80 | | - createTree(document.querySelector('ul').lastElementChild.firstElementChild.lastElementChild, data.Tree.Flowering); |
81 | | - */ |
82 | | - |
| 43 | + |
83 | 44 | //usando recursão |
84 | 45 |
|
85 | 46 | function eVazio(data) { |
|
0 commit comments