How do I get the newline character(\n) to work properly in the code playground section? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I get the newline character(\n) to work properly in the code playground section?

you can check the output of the mini code at the link below to understand better. https://code.sololearn.com/W7hnzNZlV1K7/?ref=app

31st May 2017, 12:00 PM
Olayinka Oyewole
Olayinka Oyewole - avatar
3 Answers
+ 2
for(i=1; i<11; i++){ document.write("<br> line ", i); }
31st May 2017, 12:04 PM
Calviղ
Calviղ - avatar
+ 8
Haha, you cannot. Since code playground behaves like a webpage, only <br> works. To make \n works, you would have to code in a console.
31st May 2017, 12:54 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
Oh.. I was thinking with a C approach... thanks Calvin
31st May 2017, 12:13 PM
Olayinka Oyewole
Olayinka Oyewole - avatar