To execute JavaScript in a browser you have two options —
either put it inside a script element anywhere inside an HTML document, or
put it inside an external JavaScript file (with a . js extension)
and then reference that file inside the HTML document using an empty script element with a src attribute.