The problem is that I need to create a new instance of the passed class
Is there a way to rewrite this function, so it could accept any number of arguments?
function createInstance(ofClass, arg1, arg2, arg3, ..., argN){
return new ofClass(arg1, arg2, arg3, ..., argN);
}
This function should create an instance of the passed class. Example:
var SomeClass = function(arg1, arg2, arg3){
this.someAttr = arg3;
.....
}
SomeClass.prototype.method = function(){}
var instance = createInstance(SomeClass, 'arg1', 'arg2', 'arg3');
So this should be true.
instance instanceof SomeClass == true
Right now, I've just limited N to 25, with hope that more arguments are rarely used.