I'm newbie at JS, and I didn't understand a thing.
The problem is, I have a fs.readfile
function, and there is while(1){//code}
code execution bottom of it.
The example:
const prompt = require('prompt-sync')();
let fs = require('fs');
function aFuncName() {
let nms;
fs.readFileSync('filename.txt', (error, data) => {
console.log('readfile began!')
if (error)
console.log(error);
try {
nms = data.toString().match(/\n/).length
console.log('ind:' + String(ind))
} catch (TypeError) {
nms = 0;
}
console.log("readfile over!");
});
let userarry = [nms]
while (1) {
let vars = prompt('varsm):')
}
}
the problem is, the function passes the fs.readfilesync
part and begins from let userarry
.
I also tried fs.readFile