提交 061ffd65 编写于 作者: 杜庆泉's avatar 杜庆泉

Update number.md

上级 2221a909
......@@ -23,3 +23,24 @@ console.log(financial(123.456));
console.log(financial(0.004));
// expected output: "0.00"
```
### toInt()
toInt() 方法将当前的Number数据转换为Int表示,如果超出Int最大值表示范围,会得到溢出后余数表示
**平台差异说明**
|JavaScript|Kotlin|Swift|
|:-:|:-:|:-:|
|√|√|√ `(3.6.11+)`|
```ts
let a = 12
console.log(a.toInt());
// expected output: 12
// Int最大值2147483647,溢出了
let b = 2147483648
// expected output: -2147483648
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册