fs.readFile('input.txt', function(err, data) {
if (err) {
return console.error(err);
}
console.log(data.toString());
});
console.log("Program Ended");
input.txt
contains the string "hello"
.
Program Ended
hello
Why does it print "program ended"
before "hello"
?
Is it not line by line execution?