Lesson 3 / 30
Running Scripts & the REPL
Run JavaScript files with node and experiment interactively in the Node REPL.
Running a file
Save as hello.js, then run node hello.js in your terminal.
console.log("Hello from Node!");
Output:
Hello from Node!
The REPL
Running node with no file drops you into the REPL — a Read-Eval-Print Loop for quick experiments.
$ node
> 2 + 2
4
> const x = 10
undefined
> x * 2
20
> .exitQuick check: What does REPL stand for?
- Run-Execute-Process Line
- Remote Execution Protocol Layer
- Rapid Event Preview Loop
- Read-Eval-Print Loop
Answer
Read-Eval-Print Loop — It reads your input, evaluates it, prints the result, and loops.