What is difference between writing html code in .html file and wrting html code in .js file in document.write() method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between writing html code in .html file and wrting html code in .js file in document.write() method?

3rd Dec 2019, 2:31 AM
Amit Kakade
Amit Kakade - avatar
2 Answers
0
//Official html document extension is "html" or "htm", you can write html from javascript that's not a problem but official way is easy and clean https://www.sololearn.com/learn/HTML/1023/?ref=app
3rd Dec 2019, 8:09 PM
Sudarshan Rai
Sudarshan Rai - avatar
0
For the actual html there is no difference, the real difference is how the html is injected into the Dom doing it through JavaScript gives you the option to manipulate it or adding it to the Dom instead of writing it straight to the Dom
28th Nov 2021, 11:55 AM
Lars DK
Lars DK - avatar