You are currently viewing What Else Does the JavaScript Runtime Contain?

What Else Does the JavaScript Runtime Contain?

 What is JavaScript Runtime

In this article, we will learn about what is node.js javascript runtime. JavaScript runtime is an environment that provides all the necessary components in order to use and run a JavaScript program. Every browser has a JavaScript engine. It is one component in the JavaScript Runtime.

What Else Does the JavaScript Runtime Contain?

Let’s understand using chrome browser as an example:

javascript runtime example

The JavaScript code, we write is executed in Chrome’s JavaScript runtime which consists of the following components.

  • JavaScript engine
  • Web/ Browser APIs
  • Queues and
  • Event Loop

The JavaScript engine is the v8 engine that executes JavaScript codes. It consists of a call stack, where JavaScript code gets executed, and a heap which is nothing but memory to store all the variables that a JavaScript application needs.

Web/Browser APIs refer to the DOM, TIMERS such as setTimeout and setInterval, and STORAGE, which add extra functionality to the JavaScript engine but are not part of the JavaScript language itself. All web APIs are provided by the browser.

Queues are where asynchronous tasks weigh before they can be executed.

Event Loop ensures async tasks are executed in the right order. This at a very high level is the overview of JS runtime in the browser.

The highlight of this visualization is that just a JavaScript engine is not sufficient in the grand scheme of things. The engine itself can execute ECMASCRIPT but JavaScript as we know it is ECMASCRIPT plus all these web API like consolelog, setTimeout, DOM APIs, etc. So, to run the JS code we write every day a browser needs not just a JS engine but the JS Runtime.

READ ALSO  3 Ways to Remove an Item from an Array by Index in JavaScript


We have learned what is ECMASCRIPT, which in turn helped us understand what is a JS engine which in turn helped us understand what is JS runtime.

Leave a Reply