To understand how JavaScript runs and its operating mechanism, first of all, we need to understand the kernel of the browser: Browser kernelThose who have learned about it know that different browsers are composed of different kernels. So what kernels are there and what kernels are used by our commonly used browsers:
The so-called browser kernel refers to the browser's typesetting engine, that is, the browser engine. The engine's work execution process is as follows: But during this execution process, what should we do if we encounter JavaScript tags when parsing HTML? Of course, why not just load and execute the JavaScript code asynchronously instead of stopping here? Therefore, the browser wants to put the DOM parsed by HTML and the DOM after JavaScript operations together to generate the final DOM tree, rather than frequently generating new DOM trees; So, who executes the JavaScript code? JavaScript EngineWhy do we need a JavaScript engine?
What are the common JavaScript engines?
V8 Engine
The principle of V8 engine executing JavaScript code: The Parse module converts JavaScript code into AST (Abstract Syntax Tree) because the interpreter does not directly understand JavaScript code;
Ignition is an interpreter that converts AST into ByteCode
TurboFan is a compiler that compiles bytecode into machine code that the CPU can directly execute;
The above is the execution process of JavaScript code Learn, record, and encourage each other! This is the end of this article about how JavaScript works. For more information about how JavaScript works, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of Nginx status monitoring and log analysis
MySQL 8.0: MVCC for Large Objects in InnoDB In th...
The data URI scheme allows us to include data in a...
To install VMWare under Linux, you need to downlo...
Classification of color properties Any color can ...
This work uses the knowledge of front-end develop...
The RHEL/CentOS series of Linux operating systems...
Table of contents Getting Started with MySQL MySQ...
Effect diagram: Overall effect: Video loading: Ph...
I. Strict Mode Explanation According to the restr...
I am planning to build my own website, so I took ...
Since 2019, both Android and IOS platforms have s...
Configuring network connectivity for Linux system...
Methods for changing passwords before MySQL 5.7: ...
Preface I made a loading style component before. ...
When developing for mobile devices, you often enc...