๐ Newlines
June 20, 2021 ยท View on GitHub
The character representation of a
newline is OS-specific. On Unix it is
\n (line feed) while on Windows it is \r\n (carriage return followed by line
feed).
Newlines inside a template string translate to \n on any OS.
const string = `this is
an example`
Some Windows applications, including cmd.exe, print \n as newlines, so using
\n will work just fine. However some Windows applications don't, which is why
when reading from or writing to a file the OS-specific newline
os.EOL should be used instead of
\n.
Next (๐ EOF and BOM)
Previous (๐ Character encoding)
Top