Explain please!....What is difference between document write and writeln ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 17

Explain please!....What is difference between document write and writeln ??

Are the same function write and writeln ....??

17th May 2019, 7:51 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
12 Answers
+ 9
write and writeln are the same function. The only difference is that writeln adds a new line at the end of the text
17th May 2019, 7:53 AM
Sarthak Kimtani
+ 15
Sukki😘 thank you for information..
19th May 2019, 8:05 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 14
Anhjje thank you you very helpful for me
18th May 2019, 3:32 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 14
Morris Kollie why you send hear your code ....
18th May 2019, 4:51 PM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 13
Sarthak Kimtani write and writeln are similar, why is the use of these two different?
17th May 2019, 8:23 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 12
Sarthak Kimtani I am Understood this. Thank you very much for helping me
17th May 2019, 8:51 AM
Mr AJX 😎😈
Mr AJX 😎😈 - avatar
+ 7
I am not perfect but what i understood is document.write() puts the contents directly to the browser where the user can see it. document.innerHTML is changing the HTML of the object you apply it to. Essentially, you could use document.write() without any connected HTML, but if you already have HTML that you want to change, then document.innerHTML would be the obvious choice.
21st May 2019, 12:40 PM
MD Salauddin
MD Salauddin - avatar
+ 4
The second one is a write with implicit "\n" ....
17th May 2019, 2:39 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 4
Write("a"); Write("b"); Console output: ab It writes in the same line. writeln = writeLINE which adds another line at the end. writeln("a"); writeln("b"); Console output: a b
18th May 2019, 1:50 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 3
Because it adds a new line at the end of the text
17th May 2019, 8:28 AM
Sarthak Kimtani
- 1
Mhysm vudx
18th May 2019, 4:48 PM
Morris Kollie
Morris Kollie - avatar