0

Does JavaScript support the way of changing the line using /n metho

30th Aug 2017, 6:22 AM
Tanay
Tanay - avatar
2 Respostas
+ 5
Javascript support, but Html output doesn't ^^ Methods like alert() output outside of Html document (modal input boxes are done by OS through browser)... This is also the case for methods such as 'console.log()'... But most of output in JS are done inside Html document content (document.write(), element.innerHTML='...'), where new lines ('\n') are mostly treated as space (since you don't use a <pre> container or doesn't modify the value of 'white-space' such css property), and breaking line must be done by writting '<br>' in a string outputed inside Html content ;P
30th Aug 2017, 8:18 AM
visph
visph - avatar
+ 4
Yes, you can use a "\n" in a string to advance to a newline. alert("Hello\nWorld"); outputs: Hello World
30th Aug 2017, 6:49 AM
ChaoticDawg
ChaoticDawg - avatar