Should I include language="javascript" in my SCRIPT tags?


The language attribute in JavaScript is optional since the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers. Therefore, now adding javascript isn’t required in <script> tag.

This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.

Here you can see how it is used:

<html>
   <body>
      <script>
         <!--
            document.write("Hello World!")
         //-->
      </script>
   </body>
</html>

Updated on: 30-Sep-2019

307 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements