1.

What does the leading semicolon in JavaScript libraries do?

Answer»

JavaScript used previously had the TYPE ATTRIBUTE USAGE like this:

<html>    <body>       <script language="javascript" type="text/javascript">          <!--             document.write("Demo!")          //-->       </script>    </body> </html>

Above, you can SEE we have SET the script language as “javascript” and the type as “text/javascript”.

The usage of type=”text/javascript” was necessary before the introduction of HTML5. But, when HTML5 came, JavaScript became its default language. Therefore, adding “text/javascript” is optional.



Discussion

No Comment Found