Skip to content

Instantly share code, notes, and snippets.

@shawndumas
Created April 12, 2016 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawndumas/2da7b258029d542e2392ff9fd50e233e to your computer and use it in GitHub Desktop.
Save shawndumas/2da7b258029d542e2392ff9fd50e233e to your computer and use it in GitHub Desktop.
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