Skip to content

Instantly share code, notes, and snippets.

@halitbatur
Created May 7, 2022 07:17
Show Gist options
  • Save halitbatur/5d89be2e3fe15bac3fa2fe349c7de91d to your computer and use it in GitHub Desktop.
Save halitbatur/5d89be2e3fe15bac3fa2fe349c7de91d to your computer and use it in GitHub Desktop.
Node JS discussion questions

Node JS discussions

These are some Node JS discussion questions to deepen your understanding of NodeJS

  1. Differentiate between JavaScript and Node.js.
  2. Why Node.js is single threaded?
  3. How do Node.js works?
  4. What is package.json?
  5. What is an Event loop in Node.js and how does it work?
@awiednoor
Copy link

These are some Node JS discussion questions to deepen your understanding of NodeJS
Differentiate between JavaScript and Node.js.
Js is a language , node js is runtime environment built in this language along with C/C++.
Why Node.js is single threaded?
Node.js use Single Threaded Event Loop Model architecture to handle multiple concurrent clients Which is inspired by js event model with js callback mechanism.
How do Node.js works?
It handles requests and responses from and to the server with a single thread, It manages files on the server
It’s build on the v8 engine which allows it to run js outside the browser
Node.js works on two concepts, Asynchronous and Non-blocking I/O
What is package.json?
It’s a json file that holds information about the project and the list of dependencies with their versions.
What is an Event loop in Node.js and how does it work?
An event loop is an event-listener which functions inside the NodeJS environment
Event loops allow node.js to be non-blocking because events are used to perform the operations in one thread.
As a single-threaded application, Node.js can support concurrency through the concept of events and callbacks. Because Node.js APIs are all asynchronous, they use async function calls to maintain concurrency. Node uses observer pattern. When a task is completed, the node thread fires the corresponding event which signals the event-listener function to run.
Event queue, the requests are placed in the event queue in a single thread, then the event loop takes each event and run the callback function related to this event.

Noor Awied, Nilay aydin & Rama Shaban

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment