Can external pure javascript files be accessed from Unity?

I am looking at releasing a project to the web and I wanted to try to integrate Unity in to said project.
For testing I tried setting up an event in unity that would being up an alert window in the browser, but even having a file with “alert” within the Unity project stops Unity in it’s tracks.

Is there a way to access a js file that would have just an alert (as below), that I could then build upon for better integration?

Apologies for the basic question, all my searches seemed to only bring me to UnityScript results.

 function show_alert()
    {
        alert("Test successful.");
    }

Yes they can, though not directly. Use Application.ExternalCall to call js methods. Or use Application.ExternalEval to run js code written in unity.

You can alternatively put browser js files in the unity project by putting them in Assets/Plugins/WebGL/ and giving them the extension.jslib. You can then use C#'s native interop to call those methods.

For example, if you had a function called show_alert in your browser js, call it

Application.ExternalCall("show_alert");