Skip to content

Instantly share code, notes, and snippets.

@fdjones
Created March 14, 2018 14:07
Show Gist options
  • Save fdjones/738d7b12135a8245a530bc08d5a1b250 to your computer and use it in GitHub Desktop.
Save fdjones/738d7b12135a8245a530bc08d5a1b250 to your computer and use it in GitHub Desktop.
// Option 1 (wrong)
function superclass() {this.stuff="stuff";}
function subclass(superclass) {}
// Option 2 (wrong)
function superclass() {this.stuff="stuff";}
function subclass() {subclass.prototype = new superclass();}
// Option 3 (the option that I chose) - wrong
function superclass() {this.stuff="stuff";}
var subclass = new superclass();
Option 4 - Correct
function superclass() {this.stuff="stuff";}
function subclass() {}
subclass.prototype = new superclass();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment