-
-
Save joshnesbitt/4326720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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