shou2017.com
JP

How to run JavaScript locally

Sat Mar 28, 2020
Sat Aug 10, 2024

Environment

  • macOS Catalina 10.15.3
  • Node: v12.15.0

Install node.js

node.js

After installing, move to the terminal and enter node -v. If installed correctly, the version will be displayed.

$ node -v
v12.15.0

Create the JS file you want to run

Here, create a file called hello.js and write the following:

console.log('Hello JavaScript')

Then, run this hello.js file in the terminal.

$ node hello.js
Hello JavaScript

Success!

改訂新版JavaScript本格入門 ~モダンスタイルによる基礎から現場での応用まで

See Also