[I am trying to store the data read by fs in a variable. But I am getting undefined as output.](https://i.stack.imgur.com/XL4L0.png)

```

const fs = require("fs");

var a;
fs.readFile("analogData.txt", "utf8", (err, data) => {
  a = data;
});
console.log(a);

```