Answer:
Using a <script> tag.
Step-by-step explanation:
With the <script> tag you can add javascript code to your html.
The best way to do it is to link to a .js file this way
<script src="myScript.js"></script>
that way you can use the same file in many different pages.
There's also the possibility to put the js code directly into the html file like this
<script>
let a = "lalala";
/*your javascript code */
</script>
This is not considered a good practice since it would only work for one page, but it's one of the options available.