We can run JavaScript on Mac terminal just the nodeJS package.
The quickest way to get nodeJs on Mac is by making use of the brew package manager.
brew install node
Once the installation is complete, just type node to enter the Node REPL (Read-Eval-Print Loop) environment, here you can run your JavaScript code snippets.
% node
> console.log("Hello JavaScript!")
Hello JavaScript!

How to run JavaScript file using Mac Terminal
Again we can make use of node package to run .js files in Terminal.
script.js
console.log("Hello!")
% node script.js
Hello!

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!