diff --git a/docs/uts/buildin-object-api/number.md b/docs/uts/buildin-object-api/number.md index d305d269427779ee4934d7f60522c669836ca3d7..1fc3e224fabaa406bfa8ecbf0d3d459a17b836d5 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 - -``` +