Last active
March 15, 2025 17:05
-
-
Save danbeam/157bce3968df54336727 to your computer and use it in GitHub Desktop.
This file contains 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 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