Posts

Showing posts from April, 2022

JavaScript's Event Loop

Image
I have been hearing that JavaScript is a single threaded language but also non blocking as well, without really getting to know what this means actually . so a brief introduction might be of use as a start :  First JavaScript runtime : in general a runtime environment is where our programs will be executed. it determines what global objects programs can access , what built in libraries  are available to a program to interact with the outside world and it can also impacts how it runs. Two JavaScript runtime environments: the runtime environment of a browser like Chrome. the Node runtime environment In the case of the browser, this runtime environment consists of the following : The JavaScript engine (composed of the heap and the call stack) Web APIs The callback queue The event loop The main objective of the JavaScript engine is to translate source code that is written by developers to machine code that allows a computer to perform specific tasks. please note that Chrome Browse...