I got a JavaScript source code, and I don not understand something in this. Could you help me please, what does it mean?
Partnerek = (function () {
Partnerek = function () { }
//there are functions in this way
//I think this is a public function
Partnerek.foo = function foo()
{
//code
}
//there are functions in this way
//this is a non public function
function foosecondway()
{
//code
}
return Partnerek;
})()
It seems like a class, but this is not a class.
- What is this?
- Why Did the programmer write in this way?
- Is this a good way?
- What is the return value?
- Is the two function “Parameter” same in the code?
I’m not sure but to me it looks like it’s a class buildup, which executes itself. so if you would call
This variable will become an instance of this class(This is done by the return) and the constructor
Will be called.