Local object
①Array class
②Date class
Type of object Built-in object
①Global object
②Math object
Host object
Continue to learn about JS today Objects, built-in objects Global object and Math object yesterday, 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 the book says will be discussed in later chapters. -_-|||
Scope
There is only one scope in JS - public scope. All properties and methods of all objects are public. Many developers have proposed effective attribute scope patterns on the Internet to solve this problem of ECMAScript. Due to the lack of private scope, developers developed a convention that puts underscores before and after property names. Remember, these underscores don't change the fact that these properties are public; they just tell other developers that the property should be treated as private. Some developers also like to use a single underscore to indicate private members.
Keyword this
Keyword this always points to the object that calls this method, the current service object.
Why use it?
Because we don’t know the variable name of the object calling this method during development, so we use this. (When many objects call the same method)
If a variable is not referenced with an object or this keyword, ECMAScript will treat it as a local variable or global variable. The function will then look for a local or global variable named color, but it won't be found. What's the result? The function will display "null" in the warning.