What is the difference when you use document.write and document.writeln? I think I get the same result. Are they both the same? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference when you use document.write and document.writeln? I think I get the same result. Are they both the same?

8th Aug 2018, 5:00 PM
Akhila Seneviratne
Akhila Seneviratne - avatar
2 Answers
+ 5
There is a difference. With document.write you are printing on the same row. With document.writeln after printing the cursor goes to the next row / new line.
8th Aug 2018, 8:28 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Thanks!
9th Aug 2018, 12:18 AM
Akhila Seneviratne
Akhila Seneviratne - avatar