Created
August 10, 2015 01:59
-
-
Save pbse/c1f61cbd2e20939a9f28 to your computer and use it in GitHub Desktop.
Point Complete Class
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 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