+ 6
How to break line in javascript? Like.<br> in HTML
4 Réponses
+ 8
Use the \n for a newline character.
document.write("\n");
You can also have more than one:
document.write("\n\n\n"); // 3 new lines! My oh my!
However, if this is rendering to HTML, you will want to use the HTML tag for a newline:
document.write("<br>");
The string Hello\n\nTest in your source will look like this:
Hello!
Test
The string Hello<br><br>Test will look like this in HTML source:
Hello<br><br>Test
The HTML one will render as line breaks for the person viewing the page, the \n just drops the text to the next line in the source (if it's on an HTML page).
+ 7
I hope you are doing well ....the challenges are a great source of knowledge even if you loose it go through the view correct options and memorise them and also try to find logic in them hope so you will get the point Keep on challenging
/*no chat box thier for i used this to message you*/
+ 4
welcome👦⛾
+ 1
thx bro!