JavaScript · Lesson 2 of 138
Running JavaScript
Node and the browser.
There are two easy ways to run JavaScript. In a browser, or with Node dot JS on your computer. We'll use both in this course. Let's start with Node.

- Two ways to run it
- The browser, or Node
- We'll use both
Your first program
This file, app dot JS, has one line. Console dot log prints whatever you put inside the brackets. In a terminal, you'd run it by typing node app dot JS. Run it.
app.jsjavascript
console.log("Hello, JavaScript!");Output
Hello, JavaScript!
Getting set up
To follow along on your own computer, install Node dot JS from nodejs dot org, and a code editor, like Visual Studio Code. Then make a file ending in dot JS, and run it with node, followed by the file name. Or open any browser, press F twelve, and type JavaScript into the console tab.
| key | value |
|---|---|
| Node.js | nodejs.org |
| Editor | VS Code |
| Run | node app.js |
| Browser | F12, then Console |
Summary
Run JavaScript with Node, using node and a file name, or in the browser's console. Next, printing more with console dot log.
Key takeaways- node app.js
- Browser console: F12
- console.log prints
Next up: console.log — printing output