Home > Web Front-end > JS Tutorial > A brief discussion on js statements similar to (function(){}).call()_javascript skills

A brief discussion on js statements similar to (function(){}).call()_javascript skills

WBOY
Release: 2016-05-16 16:07:13
Original
1129 people have browsed it

Study the automatic login process of Sina Weibo, which involves its encryption algorithm script, which contains a piece of code in the following form:

(function(){...}).call(name)

Among them, the red ones...are various internal implementations of the function, and name is the name of an object. I have never seen this form of js (sorry, I have little experience in js). Then Baidu took a look The approximate meaning is as follows:

.call(name) actually uses name as this in the domain of the previous function, which means that this in the function is equivalent to referencing name.

The actual meaning of this code can be thought of as: the specific implementation of the function transforms the variable name, or more simply, the implementation of the function is the specific implementation of the variable name. In a sense, it is equivalent to:

var name = function(){...}

The above is the entire content of this article, I hope you all like it.

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