What does (this); mean on end of function in JavaScript?
I have a class with functions in it. Can I call this.outputSome within that class more times and/or when can I call it?
__construct = function(constructor){
//some code
}(this);
this.outputSome = function(obj){
//some
}(this);
It means that it executes itself with
thisas the parameter.When you put parenthesis at the end of a function expression, it’s self executing, and executes after it has been defined. The fact that
thisis inside the parenthesis suggests that it is passingthisas the parameter.