Skip to content

Instantly share code, notes, and snippets.

@joshnesbitt
Forked from anonymous/gist:4326703
Created December 18, 2012 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshnesbitt/4326720 to your computer and use it in GitHub Desktop.
Save joshnesbitt/4326720 to your computer and use it in GitHub Desktop.
function Bit(a, b) {
this.a = a;
this.b = b;
}
function construct() {
var args = Array.prototype.splice.call(arguments, 0);
var fn = args.shift();
function F() {
return fn.apply(this, args);
}
F.prototype = constructor.prototype;
return new F();
}
var one = new Bit(1, 2);
var two = construct(Bit, 1, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment