I see often this pattern
(function(){}).call(this)
Is that the same with this one?
(function(that){})(this)
Thanks in advance
EDIT
Are those two codes trying to solve the same problem? the context of this?
EDIT
Can anyone edit the title and provide a better one cause I think it is interesting.
Edited after the question:
No. Function.prototype.call accepts
thisas its first argument.thisis not passed into a function as a real argument in this case. However, you can address the actually passedthisasthatin the second function.EDIT: Here’s an example.
this(receiver) will most often be thewindow(more generally, the global object, whatever it is in your context. It is different e.g. for workers) which does not have themyMethodmethod.thiswill point toobj, on which themyMethodmethod will be called.