A brief discussion on the this calling object of JS

零到壹度
Release: 2018-04-21 15:17:20
Original
1833 people have browsed it

The content of this article is about a brief discussion of the this calling object of JS. It has a certain reference value. Now I share it with you. Friends in need can refer to it

Check From the information, I learned that this of JS points to the object of the call.

It’s hard to understand only this sentence, so let’s write a dome.

The code is as follows:

   this测试   

开始

点击测试

Copy after login

You can see four output problems from top to bottom

Run and see the results:


You can see that the output results of 123 are different

The first one is HTMLDOM

The second one is a p

The third one is a window

The above code can be analyzed as follows:


(PS: this refers to the previous one in the official introduction level object, typo)


Related recommendations:

Detailed explanation of this object in JS

this refers to the current object itself

Why can’t this be used in static methods in Java? , super and direct call to non-static methods

Are this and super references or objects?

The above is the detailed content of A brief discussion on the this calling object of JS. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!