Your code raises an eyebrow. It makes no sense to me why you are returning a static class to your constructor.
I think that if you return the actual instance, this may make more sense to you, but it is not necessary.
Example
function foo() { this.x = 1; return this; } var aFooInstance = new foo(); console.log(aFooInstance);
However, you might want to have private variables so that you can return such an object, in this example you can also pass data to the constructor.
function foo(x) { var _x = x; this.getX = function(){ return _x;} } var aFooInstance = new foo(1); console.log(aFooInstance.getX());
I would suggest reading more about a simple instance of a class .
source share