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.