Lesson 3 / 28
Running Scripts & the REPL
Two ways to execute JavaScript with Node.
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?
- Read-Eval-Print Loop
- Run-Execute-Process Line
- Remote Execution Protocol Layer
Answer
Read-Eval-Print Loop — It reads your input, evaluates it, prints the result, and loops.