function Vector(x, y) {
this.x = x;
this.y = y;
}
Vector.prototype.plus = function plus(otherVector) {
var x = this.x + otherVector.x;
var y = this.y + otherVector.y;
return new Vector(x, y);
};
Vector.prototype.minus = function minus(otherVector) {
var x = this.x - otherVector.x;
var y = this.y - otherVector.y;
return new Vector(x, y);
};
Vector.prototype.toString = function toString() {
return 'Vector { x: ' + this.x + ', y: ' + this.y + ' }';
}
console.log(new Vector(1, 2).plus(new Vector(2, 3)));