Q:- What Is Node.js?
Node.js is an open-source, cross-platform JavaScript runtime environment for executing JavaScript code on server side.
Ryan Dahl came up with a brilliant idea, he thought it would be great to execute JavaScript outside the browser means on the Server, so he took Google's JavaScript V8 Engine and embedded with C++ Program and called it Node.
Most Popular JavaScript Engine:
Google Chrome - V8 // Fastest JavaScript Engine
Mozilla FireFox - SpiderMonkey
Microsoft Edge - Chakra
Q:- What are the key features of Node.js?
Let's look at some of the key features of Node.js
Asynchronous and Event-Driven –
All APIs of Node.js library are asynchronous, that is, non-blocking I/O.
It means that API call doesn't wait for results and doesn't block other calls. After it finishes executing it will run a callback to notify about its completion.
It's very fast –
Node.js uses the Google Chrome's V8 JavaScript Runtime Engine written in C++, which compiles the JavaScript code into machine code making it faster.
It is used for both client-side (Google Chrome) and server-side (Node.js) JavaScript applications.
JavaScript Engine: It is a program that converts JavaScript's code into lower-level or machine code.
Single-Threaded but Highly Scalable –
Node.js is a single-threaded, which in the background (Under the hood Node.js uses many threads through libuv) uses multiple threads to execute asynchronous code.
All Node.js applications use "Single Threaded Event Loop Model" Architecture to handle multiple concurrent clients.
The Event Loop mechanism helps the server to respond in a non-blocking way, resulting in making the server highly scalable as opposed to traditional servers which create limited threads to handle requests.
Node.js library uses JavaScript –
This is another important aspect of Node.js from the developer’s point of view. The majority of developers are already well-versed in JavaScript. Hence, development in Node.js becomes easier for a developer who knows JavaScript.
NPM (Node Package Manager) –
NPM stands for Node Package Manager, it allows us to install various Packages for Node.js Application.
No Buffering –
Node.js applications never buffer any data. They simply output the data in chunks.
Community –
There is an active and vibrant community for the Node.js framework - The active community always keeps the framework updated with the latest trends in web development.
Q:- What is Modules in Node.js?
Modules are a set of functionality or javascript libraries encapsulated into a single unit, which can be reused throughout the Node.js application.
Each Node.js module has its own context
Type of Modules in Node.js?
Core (In-built) Modules
Local (User-defined) Modules
3rd Party Modules
Read the Complete Article Node.js Interview Questions
Top comments (2)
It has great knowledge share platform, Can you share MEAN STACK Interview Question and Answer?
You can find some useful article here - fullstacktutorials.com/
Hope this will help you!