提交 bbc8f399 编写于 作者: D DCloud_LXH

chore: buildInObject array.md、number.md

上级 88392e1f
...@@ -42,11 +42,11 @@ export const navbar = [ ...@@ -42,11 +42,11 @@ export const navbar = [
type: 'link', type: 'link',
link: '/uts/' link: '/uts/'
}, },
{ /* {
text: 'uni-app x', text: 'uni-app x',
type: 'link', type: 'link',
link: '/uni-app-x/' link: '/uni-app-x/'
}, }, */
{ {
text: '插件', text: '插件',
type: 'link', type: 'link',
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -522,7 +522,13 @@ console.log(sumWithInitial); ...@@ -522,7 +522,13 @@ console.log(sumWithInitial);
<!-- UTSJSON.Array.reduceRight.compatibility --> <!-- UTSJSON.Array.reduceRight.compatibility -->
### isArray() ### isArray(arg)
<!-- UTSJSON.Array.isArray.description -->
<!-- UTSJSON.Array.isArray.param -->
<!-- UTSJSON.Array.isArray.returnValue -->
```ts ```ts
console.log(Array.isArray([1, 3, 5])); console.log(Array.isArray([1, 3, 5]));
...@@ -538,6 +544,8 @@ console.log(Array.isArray(new Int16Array([15, 33]))); ...@@ -538,6 +544,8 @@ console.log(Array.isArray(new Int16Array([15, 33])));
// Expected output: false // Expected output: false
``` ```
<!-- UTSJSON.Array.isArray.compatibility -->
## 常见操作 ## 常见操作
- 创建数组 - 创建数组
......
...@@ -26,55 +26,114 @@ console.log(financial(0.004)); ...@@ -26,55 +26,114 @@ console.log(financial(0.004));
<!-- UTSJSON.Number.toFixed.compatibility --> <!-- UTSJSON.Number.toFixed.compatibility -->
### toByte() ### toInt()
toByte() 方法将当前的Number数据转换为Byte表示,如果超出Byte最大值表示范围,会得到溢出后余数表示 <!-- UTSJSON.Number.toInt.description -->
**平台差异说明** <!-- UTSJSON.Number.toInt.param -->
|JavaScript|Kotlin|Swift| <!-- UTSJSON.Number.toInt.returnValue -->
|:-:|:-:|:-:|
|√|√|x|
```ts ```ts
let a = 12 let a = 12
console.log(a.toByte()); console.log(a.toInt());
// expected output: 12 // expected output: 12
// Int最大值2147483647,溢出了
let b = 2147483648
// expected output: -2147483648
``` ```
<!-- UTSJSON.Number.toInt.compatibility -->
### toInt() ### toFloat()
<!-- UTSJSON.Number.toFloat.description -->
<!-- UTSJSON.Number.toFloat.param -->
<!-- UTSJSON.Number.toFloat.returnValue -->
<!-- UTSJSON.Number.toFloat.compatibility -->
### toDouble()
<!-- UTSJSON.Number.toDouble.description -->
<!-- UTSJSON.Number.toDouble.param -->
<!-- UTSJSON.Number.toDouble.returnValue -->
<!-- UTSJSON.Number.toDouble.compatibility -->
### toUInt()
<!-- UTSJSON.Number.toUInt.description -->
<!-- UTSJSON.Number.toUInt.param -->
<!-- UTSJSON.Number.toUInt.returnValue -->
<!-- UTSJSON.Number.toUInt.compatibility -->
### toByte()
toInt() 方法将当前的Number数据转换为Int表示,如果超出Int最大值表示范围,会得到溢出后余数表示 <!-- UTSJSON.Number.toByte.description -->
**平台差异说明** <!-- UTSJSON.Number.toByte.param -->
|JavaScript|Kotlin|Swift| <!-- UTSJSON.Number.toByte.returnValue -->
|:-:|:-:|:-:|
|√|√|√ `(3.6.11+)`|
```ts ```ts
let a = 12 let a = 12
console.log(a.toInt()); console.log(a.toByte());
// expected output: 12 // expected output: 12
// Int最大值2147483647,溢出了
let b = 2147483648
// expected output: -2147483648
``` ```
<!-- UTSJSON.Number.toByte.compatibility -->
### toLong() ### toLong()
toLong() 方法将当前的Number数据转换为Long表示,如果超出Long最大值表示范围,会得到溢出后余数表示 <!-- UTSJSON.Number.toLong.description -->
**平台差异说明** <!-- UTSJSON.Number.toLong.param -->
|JavaScript|Kotlin|Swift| <!-- UTSJSON.Number.toLong.returnValue -->
|:-:|:-:|:-:|
|√|√|x|
```ts ```ts
let a = 12 let a = 12
console.log(a.toLong()); console.log(a.toLong());
// expected output: 12 // expected output: 12
``` ```
<!-- UTSJSON.Number.toLong.compatibility -->
### toShort()
<!-- UTSJSON.Number.toShort.description -->
<!-- UTSJSON.Number.toShort.param -->
<!-- UTSJSON.Number.toShort.returnValue -->
<!-- UTSJSON.Number.toShort.compatibility -->
### toUShort()
<!-- UTSJSON.Number.toUShort.description -->
<!-- UTSJSON.Number.toUShort.param -->
<!-- UTSJSON.Number.toUShort.returnValue -->
<!-- UTSJSON.Number.toUShort.compatibility -->
### toULong()
<!-- UTSJSON.Number.toULong.description -->
<!-- UTSJSON.Number.toULong.param -->
<!-- UTSJSON.Number.toULong.returnValue -->
<!-- UTSJSON.Number.toULong.compatibility -->
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册