Is it necessary to put "type=text/javascript" in <script> tag? Because both show same result... | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Is it necessary to put "type=text/javascript" in <script> tag? Because both show same result...

https://code.sololearn.com/WS8JAOGZaO5h/?ref=app

18th Feb 2018, 10:28 AM
GOļ¼
GOļ¼ - avatar
3 Respostas
+ 4
No, it is not necessary if you use HTML5. "Differences Between HTML 4.01 and HTML5 In HTML5, the type attribute is no longer required for JavaScript. The default value is "application/javascript"." Source: https://www.w3schools.com/tags/att_script_type.asp To use HTML5 write <!doctype html> before <html> tag.
18th Feb 2018, 10:42 AM
Augustinas Lukauskas
Augustinas Lukauskas - avatar
+ 1
It is required for HTML4 but is now optional with HTML5. Hope this helps
18th Feb 2018, 10:38 AM
HazeDev
0
yet another debate
18th Feb 2018, 10:49 AM
Dobromir_K