+ 1
why doesn't "\n" work?
var i=20; do { document.write(i); document.write("\n") document.write("<br/>"); i++; } while (i<=25); //doesn't JS support "\n"?
6 Antworten
+ 2
No, it's HTML who doesn't support it :
document.write adds to the HTML page the string passed as its parameters and HTML doesn't support break lines with \n but with <br />
and \n won't render because JS will first evaluate the unicode then will render a simple new line
+ 2
thanks VCoder
+ 1
To prove that JS support \n, try : console.log("Hello\nWorld");
+ 1
You're welcome, if you follow me, I will be able to help you in the DOM and introduce you in : "Creating your own tags and attributes" topic
0
VCoder sure!