0

I am using node js and I want to log the text line by line inside a txt file. this is my code but the output is 1 and not the text inside

const lines = fs
.readFileSync("input.txt", { encoding: "utf-8" })
.split("\n")
.filter((x) => Boolean(x))
.map((x) => parseInt(x));


 for (let i = 0; i < lines.length; i++) {
  console.log(lines[i]);
 }

0 Answers0