Regarding java script programming

I got a doubt while practicing js.

actually i’m unable understand the purpose of using (type=“text/javascript”) inside the script tag.

Type is an attribute of the script tag. It is optional in HTML 5 but it was mandatory in the previous versions.
The value for type attribute specifies the media type of the script, in this case text/javascript.

1 Like

ok…!. is?using ‘Type’ attribute is really that necessary while manipulating js using html.

The “type” attributes indicates the HTML document what type of input you are giving to it.
This is mandatory as you are using JS in your HTML document.
If you do not use the “type” attribute , the document cannot understand your JS code.

1 Like

thanks for contributing.

Welcome. Do let me know if you have any other problem.

sure…!my dear friend.