-
-
Save ssll-ooww/e80d09708d4319e0906ffee2b2b85b34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Rect(width, height) { | |
this.width = width; | |
this.height = height; | |
} | |
Rect.prototype.type = function() { return "rect"; }; | |
function Square(width) { | |
return new Rect(width, width); | |
} | |
Square.prototype.type = function() { return "square"; }; | |
sq = new Square(12); | |
log(sq.type()); //=> ??? | |
log(sq instanceof Square); //=> ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment