+ 3

Why the new line "\n" not working!

I have added the following variable var y = 2; document.write(x); document.write("\n y = "); document.write(++y); but the output is in the same line

29th May 2017, 7:28 PM
Abdulhadi Alhamad
3 Réponses
+ 11
var x = 3; var y = 2; document.write(x); document.write("<br>y = " + ++y); You can't use "\n" for document.write( ) method, fix it. EDIT - @Rrestoring won the race for 3 seconds. :3
29th May 2017, 7:39 PM
Maz
Maz - avatar
+ 5
You can use <br /> for new lines in html. Html ignores white space so \n doesn't APPEAR to do anything. Edit : @Maz rekt 😝 😶
29th May 2017, 7:39 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Thanks
29th May 2017, 7:40 PM
Abdulhadi Alhamad