Txt into one variable in JavaScript | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Txt into one variable in JavaScript

Hi Guys!! How to get the whole content of a external .txt in a variable inside your script in order to apply some regular expression?

6th Mar 2019, 2:13 AM
Eugenio Fdez
Eugenio Fdez - avatar
3 Respuestas
+ 5
const fileUrl = '' // provide file location fetch(fileUrl) .then( r => r.text() ) .then( t => console.log(t) )
6th Mar 2019, 2:44 AM
abdulconsole
abdulconsole - avatar
+ 3
Ok
6th Mar 2019, 2:58 AM
abdulconsole
abdulconsole - avatar
+ 1
thank you, I will try it
6th Mar 2019, 2:49 AM
Eugenio Fdez
Eugenio Fdez - avatar