JS Basic Small Note

Source: Internet
Author: User

Three-scope chain

The variables defined within the 1 function are local variables, which are the inner layer of the scope chain. The scope chain is looked up from inside out, and the search stops when found

2 does not have its own block-level scope (refers to a block of code enclosed by curly braces), such as the IF for statement

3 variables declared without the keyword VAR are global variables that are added to the nearest scope when the variable is declared with the VAR keyword.


3. Combining constructors and prototype patterns

Prototype property

The popular understanding is that it allows instances of all objects to share the properties and methods it contains.

Constructors are used to define instance properties, and prototype patterns are used to define shared properties and methods.

Distinguish between basic types and reference types

Base type: Occupies a fixed size of space in memory, and their values are stored in the stack memory.

Reference type: The object is copied to the newly allocated variable, but the pointer is copied, and the pointer points to the same object in the heap.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

JS Basic Small Note

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.