Home > Web Front-end > JS Tutorial > JavaScript study notes (5)_javascript skills

JavaScript study notes (5)_javascript skills

WBOY
Release: 2016-05-16 18:37:32
Original
1013 people have browsed it

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.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template