class Point { constructor(x, y) { this.x = x; this.y = y; } sum() { return this.x + this.y; } } var p = new Point(3, 4); p.sum()