Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 23, 2016 00:00
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 codecademydev/222634fff5cbb5aff37e347e0d588ddb to your computer and use it in GitHub Desktop.
Save codecademydev/222634fff5cbb5aff37e347e0d588ddb 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;
}
// create an "emperor" object and print the number of legs it has
Emperor.prototype = new Penguin();
var emperor = Emperor("Chris");
console.log(emperor.numLegs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment