return new game(arguments);
You are passing in the arguments object, just one object. So that's one argument.
To forward arguments to a normal function, you would use apply:
var fn = function() {
otherFn.apply(null, arguments);
};
But this does 2 things, it passes in the arguments array to use as arguments, but it also sets the execution context (value of this
). But a constructor function creates it's own value of this. This presents a problem...
Forwarding the arguments to a constructor is much trickier in plain JS. In Coffee script, it's easy, but it compiles into some crazy JS. See here
The trick seems to be to make an a new subclass with a no-op constructor, and invoke the constructor manually.
var newConstructor = function() {}; // no-op constructor
newConstructor.prototype = Game.prototype; // inherit from Game
var child = new newConstructor(); // instantiate no-op constructor
var result = Game.apply(child, arguments); // invoke real constructor.
But that's pretty hairy. Perhaps you should rethink your approach.