+ 5

Why dont work "\n" in javascript.

I maked a projekt, but I looked I cant write the text with"\n" why?

17th Apr 2019, 6:21 AM
Ocram Co
Ocram Co - avatar
3 ответов
+ 7
When you’re using document.write, because it’s writing to the document as HTML, a new line should be <br/> instead of \n.
17th Apr 2019, 8:13 AM
Rowsej
Rowsej - avatar
+ 6
Your question is not clear but if you mean why "\n" is not visible as text in js then it is because it is newline character i.e it can be used to get an similar effect as html <br> tag.
17th Apr 2019, 7:42 AM
Gursharan Singh
Gursharan Singh - avatar
0
\n creates a new line. It dosen't show on screen. if that wasn't what you were looking for, I'm sorry.
4th Jun 2024, 7:10 PM
Otto Rohrer
Otto Rohrer - avatar