Skip to content

Instantly share code, notes, and snippets.

@danbeam
Last active January 19, 2023 09:26
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 danbeam/157bce3968df54336727 to your computer and use it in GitHub Desktop.
Save danbeam/157bce3968df54336727 to your computer and use it in GitHub Desktop.
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