+ 6

How to break line in javascript? Like.<br> in HTML

27th Mar 2018, 1:01 PM
naufal fawwaz
naufal fawwaz - avatar
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).
27th Mar 2018, 1:04 PM
Baraa AB
Baraa AB - avatar
+ 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*/
3rd Apr 2018, 6:38 AM
Abdul Rehman
Abdul Rehman - avatar
+ 4
welcome👦⛾
3rd Apr 2018, 6:49 AM
Abdul Rehman
Abdul Rehman - avatar
+ 1
thx bro!
3rd Apr 2018, 6:42 AM
naufal fawwaz
naufal fawwaz - avatar