未验证 提交 689b118a 编写于 作者: O openharmony_ci 提交者: Gitee

!6145 翻译完成:5808 Add TS constraint to the example of docs file Cherry-pick到master

Merge pull request !6145 from wusongqing/cherry-pick-1656550038
......@@ -320,10 +320,10 @@ arrayList.add(2);
arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.replaceAllElements((value, index) => {
arrayList.replaceAllElements((value: number, index: number)=> {
return value = 2 * value;
});
arrayList.replaceAllElements((value, index) => {
arrayList.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -394,8 +394,8 @@ arrayList.add(2);
arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.sort((a, b) => a - b);
arrayList.sort((a, b) => b - a);
arrayList.sort((a: number, b: number) => a - b);
arrayList.sort((a: number, b: number) => b - a);
arrayList.sort();
```
......
......@@ -364,10 +364,10 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
list.replaceAllElements((value, index) => {
list.replaceAllElements((value: number, index: number) => {
return value = 2 * value;
});
list.replaceAllElements((value, index) => {
list.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -439,8 +439,8 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
list.sort((a, b) => a - b);
list.sort((a, b) => b - a);
list.sort((a: number, b: number) => a - b);
list.sort((a: number, b: number) => b - a);
```
### getSubList
......@@ -472,9 +472,9 @@ list.add(2);
list.add(4);
list.add(5);
list.add(4);
let result = list.subList(2, 4);
let result1 = list.subList(4, 3);
let result2 = list.subList(2, 6);
let result = list.getSubList(2, 4);
let result1 = list.getSubList(4, 3);
let result2 = list.getSubList(2, 6);
```
### clear
......
......@@ -319,10 +319,10 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
vector.replaceAllElements((value, index) => {
vector.replaceAllElements((value: number, index: number) => {
return value = 2 * value;
});
vector.replaceAllElements((value, index) => {
vector.replaceAllElements((value: number, index: number) => {
return value = value - 2;
});
```
......@@ -394,8 +394,8 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
vector.sort((a, b) => a - b);
vector.sort((a, b) => b - a);
vector.sort((a: number, b: number) => a - b);
vector.sort((a: number, b: number) => b - a);
vector.sort();
```
......@@ -620,7 +620,7 @@ vector.add(2);
vector.add(4);
vector.add(5);
vector.add(4);
let result = vector.toSting();
let result = vector.toString();
```
### copyToArray
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册