Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 12, 2016 21:21
Show Gist options
  • Save codecademydev/ccd5005a80ec69144db09e4a09f1c58a to your computer and use it in GitHub Desktop.
Save codecademydev/ccd5005a80ec69144db09e4a09f1c58a to your computer and use it in GitHub Desktop.
Codecademy export
function Penguin(name) {
this.name = name;
this.numLegs = 2;
}
// create your Emperor class here and make it inherit from Penguin
function Emperor(name) {
this.name = name;
}
Emperor.prototype = new Penguin();
// create an "emperor" object and print the number of legs it has
var emperor = new Emperor("lucas");
console.log(emperor.numLegs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment