Based on your original question, it sounds like you want to run js in the browser and not do server side js?
If that's the case create this html file:
<html>
<head>
<script type="text/javascript" src="whatever.js"></script>
</head>
<body></body>
</html>
And place it in the document root of the web server running on your machine, with your js code in a file called whatever.js alongside it. Then navigate to localhost in your browser, the js will run when the page loads.
If that's the case create this html file: <html> <head> <script type="text/javascript" src="whatever.js"></script> </head>
<body></body> </html>
And place it in the document root of the web server running on your machine, with your js code in a file called whatever.js alongside it. Then navigate to localhost in your browser, the js will run when the page loads.