+ 4

How to create a new line in javascript

I don't remember if it was \n or something like this and don't know how to implement it in doc.write

9th Oct 2018, 1:18 PM
//pascal_rabbit
//pascal_rabbit - avatar
6 Answers
+ 4
IE8 and Opera 9 on Windows use \r\n. All the other browsers I tested (Safari 4 and Firefox 3.5 on Windows, and Firefox 3.0 on Linux) use \n. They can all handle \n just fine when setting the value, though IE and Opera will convert that back to \r\n again internally. There's a SitePoint article with some more details called Line endings in Javascript. Note also that this is independent of the actual line endings in the HTML file itself (both \n and \r\n give the same results). https://stackoverflow.com/questions/1155678/javascript-string-newline-character
9th Oct 2018, 1:24 PM
Willem Roos
+ 3
\n
10th Oct 2018, 11:12 PM
Abdou
+ 2
POONAM can you give an example?
10th Oct 2018, 3:44 PM
//pascal_rabbit
//pascal_rabbit - avatar
+ 2
Dai Abdesslam great, thanks.
11th Oct 2018, 5:05 AM
//pascal_rabbit
//pascal_rabbit - avatar
+ 2
//pascal_rabbit you're welcome
11th Oct 2018, 6:09 AM
Abdou
+ 1
\n can be used
10th Oct 2018, 12:54 PM
POONAM
POONAM - avatar