Vecktor неправильно написано
class Vector1 {
constructor(x, y) {
this.x = x;
this.y = y;
}
add(vector) {
this.x += vector.x;
this.y += vector.y;
return this;
}
}
class Vector2 {
constructor(x, y) {
this.x = x;
this.y = y;
}
static add(vector1, vector2) {
return new this(vector1.x + vector2.x, vector1.y + vector2.y);
}
}
console.log('Vector1', new Vector1(1, 2).add(new Vector1(2, 3)));
console.log('Vector2', Vector2.add(new Vector2(1, 2), new Vector2(2, 3)));