AlexA
Reactiflux4y ago
3 replies
Alex

✅ – Alex. – 10-04 Oct 30

Hi i have this code :
fetch("./Data/normal.txt")
    .then((r) => r.text())
    .then((text) => {
        console.log(
            '["' +
                text.replaceAll(" = ", '","').replaceAll("\n", '"],\n["') +
                '"]'
        )
    })

What this code does is: it takes the text from text file then it convert them to array type but the array is string and i want it to be array what should i do?
// Data inside normal.txt
der Spiegel = the mirror
die Spinne = the spider
Was this page helpful?