+ 1

Does anyone know how to fix the codes so then they’re not all clumped together?

Right now in my practice js document, it looks like this: “Hey Sololearn peeps!Random number incoming, it will be: 145Since I'm still only a beginner, a lot of this won't look right or make sense, but feel free to make comments if you have suggestions on how to fix it!I really do not know how to separate the codes on the document, please help 💀.”

2nd Apr 2022, 6:59 PM
: 3
: 3 - avatar
1 Answer
+ 3
document.write( ) outputs raw text if you didn't put any HTML tags in the output. HTML ignores whitespaces and that's why you see the text looking clumped together like that. Try this document.write("<h1>Hello world</h1>"); document.write("<p>Greetings from me</p>"); Then observe the difference in output. You'll see the output will look better organised, cause there are text and HTML elements being written there, more than raw text with no formatting.
2nd Apr 2022, 9:20 PM
Ipang