0

How to use /n in JS

How to put /n in js to avoid smth like this(15300hello) https://code.sololearn.com/WgNEa9Ns533A/?ref=app

7th Jan 2021, 3:10 PM
🌚Elina
🌚Elina - avatar
1 Respuesta
+ 6
If you want to create a line break while outputting to html, you should use the <br> tag instead of \n This should work, in your case: var sayHello = '<br> Hello everybody! I am new in JS'; Or even: document.write(y+"<br>"); If your output would be an alert box, then you could use \n to create line breaks Try this, for example: var sayHello = ' Hello everybody!\nI am new in JS'; alert(sayHello);
7th Jan 2021, 3:33 PM
Qwerty Uiop
Qwerty Uiop - avatar