Computer Science, asked by surbhi3471, 1 year ago

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

Answers

Answered by amalraj142003
1


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

Adding language attribute with “text/javascript” is mandatory or optional. If it’s optional, then I would like to know why its usage has been made optional?

Follow Answer 8

1 Answer

mkotla

Mkotla

Answered on 5th Jan, 2018

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>

mark it as a brainlist
Similar questions