Summary of JavaScript execution sequence

Source: Internet
Author: User

As a web developer, it is important to understand the sequence of JS execution, the principle of parsing, otherwise it will not be able to control the small and useful language

JavaScript is a language that implements the dynamic effects of a Web page, and is primarily responsible for interacting with the server, discarding the constraints of classes like Java, simplifying the data structure, and using the TypeOf operator to get only number,string,boolean,underfined , Null,function,object, return simple, then say the JS execution sequence

JS is a block (code block) execution of the 1> the browser parses the HTML when parsing JS, like the first to download JS into the browser memory (XML-like DOM parsing, note: XML is parsed into the computer memory)

2> Enter code block one

3> Grammar detection: Do parsing, if there are errors, you cannot load the page (parenthesis mismatch, write wrong semicolon) (syntax error), similar to the compilation error in Java (into the next block of code)

4>. Preprocessing: Preprocessing the var variable and function in the JS block, at which point the variables and function in JS are declared, but are not assigned, similar to the loading into the method area in Java

5> Execute code block with Run error (variable not declared, etc.), execution completed into next code block execution

Also under alert () This method, alert () is a blocking method that interrupts the program, blocks all threads, JS is single-threaded, starts the execution queue to execute the method,

Article reference: (which contains declarative functions and variable-type functions to perform chunked behavior) http://www.admin10000.com/document/3752.html

Summary of JavaScript execution sequence

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.