Need Assistance?

support@tutorialshub.in

Node.js Fundamentals

Your first Node.js program

Node.js Free Lesson
5 min read
ADVERTISEMENT

Create an app.js file and place JavaScript inside it. Node executes the file when you run node app.js.

How it works

  • Node loads the file.
  • V8 executes the JavaScript.
  • Node APIs provide access to server and operating-system features.

Deep dive

How a .js file is executed

The terminal starts a Node.js process, Node loads your file, and V8 executes the JavaScript. The process normally exits when there is no more work keeping the event loop active.

Experiment

Change the message, add another variable, and call a function. This helps you understand that Node.js executes normal JavaScript first; the special part is the additional Node APIs available to your program.

ADVERTISEMENT