mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
21 lines
381 B
JavaScript
21 lines
381 B
JavaScript
class Point {
|
|
#x;
|
|
#y;
|
|
|
|
constructor(x = 0, y = 0) {
|
|
this.#x = +x;
|
|
this.#y = +y;
|
|
}
|
|
|
|
get x() { return this.#x }
|
|
set x(value) { this.#x = +value }
|
|
|
|
get y() { return this.#y }
|
|
set y(value) { this.#y = +value }
|
|
|
|
equals(p) { return this.#x === p.#x && this.#y === p.#y }
|
|
|
|
toString() { return `Point<${ this.#x },${ this.#y }>` }
|
|
|
|
}
|