Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 779 Bytes

File metadata and controls

25 lines (19 loc) · 779 Bytes

📝 Newlines

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