JSFiddle - React, Tailwind, and code Playground
by Сергей Тарасевич
JavaScript
"use strict";
let result = '';
const init = function(arr) {
//console.log(arr, 1);
try {
for (let file of arr) {
return fetch(`https://fe.it-academy.by/Examples/words_tree/${file}`)
.then(function(res) {
return res.text();
})
.then(function(data) {
console.log(data);
let parsedData;
try {
parsedData = JSON.parse(data);
//console.log(parsedData, 8);
for (let file2 of parsedData) {
init(['root.txt']);
}
} catch (err) {
result += `${data}`;
console.log(result, 5);
}
})
}
} catch (err) {
//console.log(err, 3);
}
}
init(['root.txt']);