before, i already search the question asked in SOF before i deciding to ask, like here or here
but none of it solve my problem.. ok so heres my code :
const file = './PAGE1.txt';
const fs = require('fs');
fs.readFile(file,'utf-8', (e,d)=>{
let textByLine = d.split('\n'); //make it an array
let hasil=textByLine[2];
});
the page1.txt is like
Aa
Ab
Ac
so then i try
console.log(hasil)
it succeeded showing "Ac" on the console. but when i do
console.log(hasil + " Test")
it shows up "Test"
why its not "Ac Test" ?
thank you for your help.
Edit : this is solved, i just simply add '\r' :
let textByLine = d.split('\r\n'); //make it an array
and now the console show "Ac Test".
now i wanna ask what does this "\r" function?
why i need it to solve my question..
thankyou again :)