0

Hi i'm getting confused about the following execution context

let fs = require('fs');
let text;

fs.readFile('message.txt', 'utf8', function(err, contents) {
    text = contents;
}
console.log(text)

text is undefined outside the callback function..thanks!

Han Che
  • 8,239
  • 19
  • 70
  • 116

0 Answers0