Skip to content

Latest commit

聽

History

History
25 lines (19 loc) 路 779 Bytes

newlines.md

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