Skip to content

Instantly share code, notes, and snippets.

@ssll-ooww
Forked from zandroid/test_new.js
Created December 4, 2022 06:48
Show Gist options
  • Save ssll-ooww/e80d09708d4319e0906ffee2b2b85b34 to your computer and use it in GitHub Desktop.
Save ssll-ooww/e80d09708d4319e0906ffee2b2b85b34 to your computer and use it in GitHub Desktop.
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