What exactly is the JS Runtime ?

What exactly is the JS Runtime ?

JS runtime is an environment to enable the execution of JS code.

Depending on where the Javascript code is running (server-side / web-browser) there would be additional environment specific features in the runtime. For eg : In a browser runtime there is DOM access , browser event handling which are browser-specific functionality.

Node JS runtime consists of thread pool and c++ bindings.

JS Runtime in browser consists of the following :

Web API - Functionality provided to the JS engine but are not a part of JS itself. It gets access to the API through window object.

Callback Queue - Async functions such as handling user input , onclick functions , network requests utilize callback functions.These functions are placed in callback queue.Once the call stack is empty , these functions are placed in the stack.