In JavaScript, I want to create an object instance (via the new operator), but pass an arbitrary number of arguments to the constructor. Is this possible?
new
Matthew Crumley's solutions in CoffeeScript:
construct = (constructor, args) -> F = -> constructor.apply this, args F.prototype = constructor.prototype new F
or
createSomething = (-> F = (args) -> Something.apply this, args F.prototype = Something.prototype return -> new Something arguments )()