提交 0e89bee9 编写于 作者: M mahaifeng

[number]去除手动生成的代码

上级 0ddbdaeb
...@@ -103,15 +103,7 @@ Number 对象是经过封装的能让你处理数字值的对象。 ...@@ -103,15 +103,7 @@ Number 对象是经过封装的能让你处理数字值的对象。
<!-- UTSJSON.Number.toFixed.returnValue --> <!-- UTSJSON.Number.toFixed.returnValue -->
```ts <!-- UTSJSON.Number.toFixed.test -->
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"
```
<!-- UTSJSON.Number.toFixed.compatibility --> <!-- UTSJSON.Number.toFixed.compatibility -->
...@@ -165,6 +157,8 @@ console.log(financial(0.004)); ...@@ -165,6 +157,8 @@ console.log(financial(0.004));
<!-- UTSJSON.Number.valueOf.returnValue --> <!-- UTSJSON.Number.valueOf.returnValue -->
<!-- UTSJSON.Number.valueOf.test -->
<!-- UTSJSON.Number.valueOf.compatibility --> <!-- UTSJSON.Number.valueOf.compatibility -->
### toInt() ### toInt()
...@@ -175,15 +169,7 @@ console.log(financial(0.004)); ...@@ -175,15 +169,7 @@ console.log(financial(0.004));
<!-- UTSJSON.Number.toInt.returnValue --> <!-- UTSJSON.Number.toInt.returnValue -->
```ts <!-- UTSJSON.Number.toInt.test -->
let a = 12
console.log(a.toInt());
// expected output: 12
// Int最大值2147483647,溢出了
let b = 2147483648
// expected output: -2147483648
```
<!-- UTSJSON.Number.toInt.compatibility --> <!-- UTSJSON.Number.toInt.compatibility -->
...@@ -225,11 +211,7 @@ let b = 2147483648 ...@@ -225,11 +211,7 @@ let b = 2147483648
<!-- UTSJSON.Number.toByte.returnValue --> <!-- UTSJSON.Number.toByte.returnValue -->
```ts <!-- UTSJSON.Number.toByte.test -->
let a = 12
console.log(a.toByte());
// expected output: 12
```
<!-- UTSJSON.Number.toByte.compatibility --> <!-- UTSJSON.Number.toByte.compatibility -->
...@@ -241,11 +223,7 @@ console.log(a.toByte()); ...@@ -241,11 +223,7 @@ console.log(a.toByte());
<!-- UTSJSON.Number.toLong.returnValue --> <!-- UTSJSON.Number.toLong.returnValue -->
```ts <!-- UTSJSON.Number.toLong.test -->
let a = 12
console.log(a.toLong());
// expected output: 12
```
<!-- UTSJSON.Number.toLong.compatibility --> <!-- UTSJSON.Number.toLong.compatibility -->
...@@ -372,13 +350,7 @@ console.log(a.toLong()); ...@@ -372,13 +350,7 @@ console.log(a.toLong());
<!-- UTSJSON.Number.from.compatibility --> <!-- UTSJSON.Number.from.compatibility -->
```ts <!-- UTSJSON.Number.from.test -->
let a: Int = 12
let b = Number.from(a)
console.log(b);
// expected output: 12
```
<!-- UTSJSON.Number.tutorial --> <!-- UTSJSON.Number.tutorial -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册