JavaScript engine and browser

Who is in charge of running JavaScript code in the browser?

December 5, 2024

In articles Browser rendering pipeline part 1 and Browser rendering pipeline part 2, we have reviewed the browser rendering pipeline, and know that the browser will parse the HTML, CSS and JavaScript code to render the page, now let's talk about the JavaScript engine.

Higher level programming languages

JavaScript is a higher level programming language, it's designed to be easy to understand and use, but the computer can't understand it, the only thing that the computer can understand is binary code, which is a sequence of 0 and 1 (CPU can only understand 0 and 1).

JS engine is help to translate JavaScript code to binary code in order to run it on the computer.

Is there a low level programming language?

Yes, there are some low level programming languages, such as C, C++, Rust, etc.

Common JS engines

The relationship between browser and JS engine

Take webkit as an example, webkit is made up of two parts:

Main flow

When the browser receives the JS code, the JS engine will do the following steps:

Parsing phase

Execution phase

Browser Architecture

browser architecture

Summary

Back to Blog 🏃🏽‍♀️