Published on

What is a `JavaScript Runtime`?

Authors
  • avatar
    Name
    hwahyeon
    Twitter

Runtime refers to the environment in which a program is executed in programming. In other words, it's the set of components necessary for a program to run.

Each programming language has its own runtime environment. For example, JavaScript is executed in runtime environments like web browsers or Node.js, while Java is executed in a runtime environment called the JVM (Java Virtual Machine).

JavaScript Runtime

Browser (JavaScript Engine):

JavaScript was originally designed to run inside web browsers. Web browsers have built-in JavaScript engines that can interpret and execute JavaScript code.

  • Chrome: V8 engine
  • Firefox: SpiderMonkey engine
  • Safari: JavaScriptCore engine

Node.js:

Node.js is a server-side JavaScript runtime environment that allows JavaScript to run outside of the browser. It is built on Google’s V8 engine and enables developers to write server-side applications using JavaScript.

The JavaScript runtime manages the execution order of JavaScript code through the call stack and event loop. It also handles asynchronous operations (e.g., setTimeout, fetch), allowing JavaScript to operate with event-driven logic.