Why dont work "\n" in javascript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
2 Answers
+ 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