Created
April 12, 2016 20:44
-
-
Save shawndumas/2da7b258029d542e2392ff9fd50e233e 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
var Point2D = function (x, y) { | |
if (x === null || x === undefined) { x = 1; } | |
if (y === null || y === undefined) { y = 1; } | |
this.x = x; | |
this.y = y; | |
}; | |
Point2D.prototype = { | |
equals: function () { | |
return this.x === other.x && this.y === other.y; | |
} | |
}; | |
Point = function () { | |
Point2D.apply(this, arguments); | |
}; | |
Point.prototype = new Point2D(); | |
Point.prototype.toString = function () { | |
var prefix = [].join.call(arguments, ', ').replace(/,\s$/, ''); | |
return 'prefix: ' + prefix + ' <' + this.x + ', ' + this.y + '>'; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment