Node.js consists of two things: a runtime environment and libraries

Tadashi Shigeoka ·  Sun, August 17, 2014

After reading the Node Beginner’s Book, the expression “Node.js consists of two things: a runtime environment and libraries” personally clicked with me, so I’m making a note so I don’t forget.

Server-side JavaScript

JavaScript first saw the light of day in browsers. However, this is merely a context. While context determines what can be done with a language, that doesn’t mean it’s equivalent to what the language itself can do. JavaScript is a “complete” language and can be used in various contexts. Everything that can be done in other languages can also be done in JavaScript.

Node.js is also just one context. Node.js allows JavaScript to run on the backend, outside of browsers.

For JavaScript to run on the backend, it must be converted by an interpreter and then executed. Node.js does this. Internally, it uses Google’s V8 VM. The V8 VM is the same JavaScript runtime environment that Google Chrome uses.

In addition, Node.js comes bundled with many useful modules. You don’t need to create everything from scratch. For example, there are modules for outputting strings to the console.

In other words, Node.js consists of two things: a runtime environment and libraries.

That’s all from the Gemba.