First, install Node.js, so you could run
node command in your Terminal.
On a Mac, you can do it via Homebrew:
brew install node
test.js with this content:
node with this file:
And you will see this printed in the Terminal: