function subclass(base, child) { | |
function temp() {} | |
temp.prototype = base.prototype; | |
child.prototype = new temp; | |
} | |
function a(){} | |
a.prototype = {foo: 'bar'}; | |
function b(){} | |
subclass(a, b); | |
b.prototype.bat = 'baz'; | |
new b(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment