const fs = require('fs');
fs.readFile('input.txt', 'utf8',(err,data)=>{
if(err){
console.error(err);
return;
}
console.log(data);
});
I have this code I found on a youtube tutorial, it just reads the data from the text file, now I have this:
1 0 1 0 1
1 0 1 0 1
0 0 0 0 1
1 0 1 0 0
1 0 0 0 1
Now, in order to work with that data I have to make it look like this:
[[1,0,1,0,1],
[1,0,1,0,1],
[0,0,0,0,0],
[1,0,1,0,0],
[0,0,0,0,1]];
Only restriction is that I can´t use loops in this assigment (while & for loops), every function that is build in javascript is allowed, I can also use the Underscore library (https://underscorejs.org/)
I am just starting with Javascript, please let me know if there is some useful function or something that I can do to make it, thanks in advance.