How Javascript Works Everything in javascript happens inside Execution Context . Execution Context is like a big box. It has memory(variable environment) and code(thread of Execution ). memory stores all variable and functions in key value pair form . and on thread code is executed line by line. javascript is synchronous single threaded language . It means javascript can execute one command at a time in specific order. it will only go to next line once the current command is executed .
https://medium.com/@Rahulx1/understanding-event-loop-call-stack-event-job-queue-in-javascript-63dcd2c71ecd call stack Javascript is single threaded asynchronous language . Using asynchronous JavaScript (such as callbacks, promises, and async /await), you can perform long network requests without blocking the main thread. Event loop Event loop is an endless loop, which waits for tasks, executes them and then sleeps until it receives more tasks. It allows node js to perform non-blocking I/O operations. Explain asynchronous and non-blocking APIs in Node.js. All Node.js library APIs are asynchronous, which means they are also non-blocking A Node.js-based server never waits for an API to return data. Instead, it moves to the next API after calling it, and a notification mechanism from a Node.js event responds to the server for the previous API call
Comments
Post a Comment