Skip to content

Instantly share code, notes, and snippets.

@pbse
Created August 10, 2015 01:59
Show Gist options
  • Select an option

  • Save pbse/c1f61cbd2e20939a9f28 to your computer and use it in GitHub Desktop.

Select an option

Save pbse/c1f61cbd2e20939a9f28 to your computer and use it in GitHub Desktop.
Point Complete Class
function Point(x,y) {
this.x = 0;
this.y = 0;
if(typeof(x) != 'object' && typeof(y)!= 'object')
{ this.x = x;
this.y = y;
} else {
if(typeof(x) == 'object') {
this.x += x.x;
this.y += x.y;
}
if(typeof(y) == 'object') {
this.x += y.x;
this.y += y.y;
}
}
}
Point.prototype.getPoints = function() {
console.log(this.x);
console.log(this.y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment