We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4052a59 commit fb6c731Copy full SHA for fb6c731
JavaScript/8-geometry.js
@@ -5,6 +5,10 @@ class Point {
5
this.x = x;
6
this.y = y;
7
}
8
+
9
+ toString() {
10
+ return `(${this.x}, ${this.y})`;
11
+ }
12
13
14
class Polygon {
@@ -21,6 +25,10 @@ class Polygon {
21
25
22
26
return Math.abs(value) / 2;
23
27
28
29
30
+ return this.points.map((p) => p.toString()).join('; ');
31
24
32
33
34
class Rect extends Polygon {
@@ -73,3 +81,4 @@ console.log('Rotate 90');
73
81
Geometry.rotate(triangle, 90);
74
82
console.dir(triangle);
75
83
console.dir(triangle.area);
84
+console.dir(`${triangle}`);
0 commit comments