Is \\n
the universal newline character sequence in Javascript for all platforms? If not, how do I determine the character for the current environment?
I
A practical observation... In my NodeJS script I have the following function:
function writeToLogFile (message) {
fs.appendFile('myserverlog.txt', Date() + " " + message + "\r\n", function (err) {
if (err) throw err;
});
}
First I had only "\n" but I noticed that when I open the log file in Notepad, it shows all entries on the same line. Notepad++ on the other hand shows the entries each on their own line. After changing the code to "\r\n", even Notepad shows every entry on its own line.