To test, create a test.html file with the below code and place the JavaScript code between the script tag comments
<html>
<head>
<meta charset="UTF-8">
</head>
<script>
window.onload = main;
//Place JavaScript code below this comment
//Place JavaScript code above this comment
</script>
</html>
Then to run, open a modern broswer such as Firefox, Chome, or Edge, then open the devleoper tools and switch to the console. Once you have that, drag the html file onto the broswer and look for the output in the console and watch for prompts for input.