We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a919dd6 commit 286853bCopy full SHA for 286853b
JavaScript/closure-class.js
@@ -4,14 +4,13 @@ class Point {
4
constructor(ax, ay) {
5
this.x = ax;
6
this.y = ay;
7
+ const move = (dx, dy) => {
8
+ this.x += dx;
9
+ this.y += dy;
10
+ };
11
const clone = () => new Point(this.x, this.y);
12
const toString = () => `(${this.x}, ${this.y})`;
- return { clone, toString };
- }
-
- move(dx, dy) {
13
- this.x += dx;
14
- this.y += dy;
+ return { move, clone, toString };
15
}
16
17
0 commit comments