Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 2nd, 2012  |  syntax: JavaScript  |  size: 0.36 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function Penguin(name) {
  2.     this.name = name;
  3.     this.numLegs = 2;
  4. }
  5.  
  6. // create your Emperor class here and make it inherit from Penguin
  7. function Emperor(name){
  8.         this.name = name;
  9. }
  10.  
  11. // create an "emperor" object and print the number of legs it has
  12. Emperor.prototype = new Penguin();
  13. var emperor = new Object(Emperor("asd"));
  14. console.log(emperor.numLegs);