Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21849cb

Browse files
committed
完善类与接口章节的 distanceToOrigin 的实现
1 parent 7525f74 commit 21849cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

advanced/class-and-interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class Point {
201201
static origin = new Point(0, 0);
202202
/** 静态方法,计算与原点距离 */
203203
static distanceToOrigin(p: Point) {
204-
return
204+
return Math.sqrt(p.x * p.x + p.y * p.y);
205205
}
206206
/** 实例属性,x 轴的值 */
207207
x: number;

0 commit comments

Comments
 (0)