How to add javascript code in side head tag in application

When I am writing the below code in then following code comes as plain text in browser. I also tried to add the following javascript code in js file then plain text not coming in browser but below code is not working.
Please suggest.

<script type="application/javascript"> 

Not sure WHERE you write the code (it was filtered it seems, try three backticks “`” for block code (more than one line) or one single one for inline text.

Your theme has probably a template file for headers. Depending on how your theme is built it’s something called header.html in the layouts/partials/ folder. It’s probably a good idea to contact the developer of your theme. If it’s a good one you already have a file in the theme that describes how to add this type of code.