From 0e89bee9f8e1f62c0e77ab5064560d49ba2491be Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Wed, 4 Sep 2024 19:03:00 +0800 Subject: [PATCH] =?UTF-8?q?[number]=E5=8E=BB=E9=99=A4=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/uts/buildin-object-api/number.md | 42 +++++---------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/docs/uts/buildin-object-api/number.md b/docs/uts/buildin-object-api/number.md index d305d269..1fc3e224 100644 --- a/docs/uts/buildin-object-api/number.md +++ b/docs/uts/buildin-object-api/number.md @@ -103,15 +103,7 @@ Number 对象是经过封装的能让你处理数字值的对象。 -```ts -function financial(x: Number): String { - return x.toFixed(2); -} -console.log(financial(123.456)); -// expected output: "123.46" -console.log(financial(0.004)); -// expected output: "0.00" -``` + @@ -165,6 +157,8 @@ console.log(financial(0.004)); + + ### toInt() @@ -175,15 +169,7 @@ console.log(financial(0.004)); -```ts -let a = 12 -console.log(a.toInt()); -// expected output: 12 - -// Int最大值2147483647,溢出了 -let b = 2147483648 -// expected output: -2147483648 -``` + @@ -225,11 +211,7 @@ let b = 2147483648 -```ts -let a = 12 -console.log(a.toByte()); -// expected output: 12 -``` + @@ -241,11 +223,7 @@ console.log(a.toByte()); -```ts -let a = 12 -console.log(a.toLong()); -// expected output: 12 -``` + @@ -372,13 +350,7 @@ console.log(a.toLong()); -```ts -let a: Int = 12 -let b = Number.from(a) -console.log(b); -// expected output: 12 - -``` + -- GitLab