✅ – 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["') +
'"]'
)
})
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
// Data inside normal.txt
der Spiegel = the mirror
die Spinne = the spider
L
lebouwski536d ago
text.split(/\r?\n/).map(line => line.split(" = "))
UU
Unknown User536d ago