NodeJs
Node.js
Introduction to Node.js runtime - understand V8 engine, Libuv, event loop, and how Node.js enables JavaScript to run outside the browser
Introduction to Node.js
- NodeJS is not a language
- It is a runtime environment that allows you to run JavaScript code outside the browser
- It build using Chrome v8 engine(v8 wriiten in C++ ) +
Libuvand v8 engine is responsible for converting JavaScript normal code into machine code that will understand by computer. - NodeJS is a single thread
Normally JavaScript runs only inside the browser like Chrome or Firefox But NodeJS allows JavaScript to run directly on your computer server or backend
Main parts inside NodeJS
- V8 Engine – runs JavaScript code
- Libuv – handles asynchronous tasks like file system network etc
- Event Loop – keeps checking for finished tasks and runs their callbacks
- Callback Queue – stores callbacks waiting to be run
- Thread Pool – background workers that do slow tasks
Functions
Comprehensive guide to JavaScript functions - declarations vs expressions, arrow functions, lexical this, higher-order functions, and array methods (map, filter, reduce)
Event Loop
Deep dive into Node.js Event Loop - how it handles non-blocking I/O operations, phases, microtasks vs macrotasks, and async task execution with interview questions