What does it mean by runtime environment?
A runtime environment is the objects and classes that are required to run some code. Consider it as a container that executes the code.
document.getElementById function. Support for this
document object is provided by browser runtime environment.
Node is used to build backend services or APIs. In simple words, node is used to write server side code.
Node provides additional capabilities such as interacting with database, filesystem, network etc. which are not available inside a browser.
One might ask that this can be done using many frameworks out there such as ASP.NET, Django, Spring etc. But there are many features that make node stand out of already available tools.
These features are explained next.
Node.js provides many reasons to choose it.
1. Node can be used to create highly scalable and fast applications.
3. Since node uses the same language at both front and back ends, your codebase becomes more consistent since you can use the same naming conventions, tools and logic everywhere.
4. For most of the features you require in your application, there are bright chances that there is some open source library already available.
This means that there is no need for developing that feature from scratch, you will get it ready made. This is due to a large ecosystem of libraries that are available to use with node.
Node.js has many distinguishing features which make it a modern choice for creating backend services.
1. Asynchronous request processing
Asynchronous means non-blocking. Suppose a request arrives at node to read a file and return its contents.
Node does not wait for the file to be read instead, it performs this operation in background and receives another request. This is called asynchronous processing and this is what makes node very fast.
One might argue that all server side frameworks work in the same way in that they allocate a separate thread for each request which is responsible for processing that request.
But when there are many concurrent requests, the application might run out of threads and it may be required to add more hardware but with node it is never required.
2. Single Threaded
As explained above, node uses a single thread for request processing which minimizes the need for heavy hardware.
3. Very Fast
Node is built on Chrome’s V8 engine which highly reduces its request processing time.
Node website describes it as