+ 1
\n don't do anything
hi guys. Tried today to write some text paragraph and i was using \n to make text go to new line, but nothing happened.
4 Respuestas
+ 5
Whitespace is compressed when the html page is rendered.
Instead, you can use <br> to move to the next line. (It will insert a 'line break')
+ 3
code?
+ 2
Text passed to the document.write() method is put into the DOM like HTML you will therefore need to use the <br />tag not /n as this just create white space which will be ignored.
var message = "Hello <br /> my name..."
document.write(meaaage);
+ 1
var message = "Hello \n My name is Sergei";
document.write(message);
and as result in browser all in 1 line.