Created
August 12, 2015 08:30
-
-
Save FreekPaans/2183cea1e7a5edd7bc9a to your computer and use it in GitHub Desktop.
This file contains 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 Vector(x, y) { | |
this.x = x; | |
this.y = y; | |
this.Add = function(addend) { | |
if(!(addend instanceof Vector)) { | |
throw Error("addend not a Vector") | |
} | |
return new Vector(this.x + addend.x, this.y+addend.y) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment