R
Reactiflux

help-js

✅ – Alex. – 10-04 Oct 30

AAlex10/30/2022
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
Llebouwski10/30/2022
text.split(/\r?\n/).map(line => line.split(" = "))
UUUnknown User10/30/2022
3 Messages Not Public
Sign In & Join Server To View

Looking for more? Join the community!