JavaScript Study Notes (5)

Source: Internet
Author: User

Local object
① Array class
② Date class

Object Type built-in object
① Global Object
② Math object

Host Object
Continue to learn about objects in JS today, Global objects and Math objects built in yesterday, and continue today.

Host Object
All non-local objects are host objects, that is, objects provided by the host environment implemented by ECMAScript. All BOM and DOM objects are host objects, which will be discussed in later sections. -_-|

Scope
In JS, there is only one type of scope-Public scope. All attributes and methods of all objects are public. Many developers have put forward effective attribute scope models on the Internet to solve this problem of ECMAScript. Due to the lack of private scopes, developers have developed a protocol to underline the attribute names. Remember, these underscores do not change the fact that these attributes are public properties. They only tell other developers that they should regard this property as private. Some developers also like to use single underscores to indicate private members.

Keyword: this
This keyword always points to the object that calls this method, the current service object.

Why?

Because during development, I don't know what kind of variable name the object that calls this method is, and all use this. (When many objects call the same method)


If you do not use an object or the keyword this to reference a variable, ECMAScript regards it as a local variable or a global variable. Then this function will find the local or global variable named color, but it will not find it. What is the result? This function will display "null" in the warning ".


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.