JavaScript Runtime/Engine

Computers only understand binary

But it's extremely difficult to write a program in binary. So higher-level languages were invented.

Computer Language Hierarchy

Compilation - Source Code to Machine Code

Before code can be executed, it must be represented as machine code. Lower-level programming languages going through the process of compilation prior to deploying the program on the target machine. The program is deployed as an executable containing machine instructions specific to the target hardware.

For example, the web browser is a compiled program and you must select the appropriate executable for your computer.

JavaScript (and many other higher-level languages) works differently. It is loaded by the web browser as source code and is not in a state where it can be executed.

It needs what is known as a JavaScript Engine to execute the code. The web browser passes the JavaScript code to the JavaScript Engine, which reads the script statements line by line and convert the text instructions to machine instructions.

Web Browser - JavaScript Runtime Context on Client

Node.js - JavaScript Runtime Context on Server

Last updated