mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 10:22:23 +00:00
docs(array): fixed https://github.com/wangdoc/es6-tutorial/issues/22
This commit is contained in:
parent
9c0896c683
commit
642a4ab3e7
@ -881,9 +881,7 @@ sentence.at(100) // undefined
|
|||||||
|
|
||||||
## 实例方法:toReversed(),toSorted(),toSpliced(),with()
|
## 实例方法:toReversed(),toSorted(),toSpliced(),with()
|
||||||
|
|
||||||
很多数组的传统方法会改变原数组,比如`push()`、`pop()`、`shift()`、`unshift()`等等。数组只要调用了这些方法,它的值就变了。现在有一个[提案](https://github.com/tc39/proposal-change-array-by-copy),允许对数组进行操作时,不改变原数组,而返回一个原数组的拷贝。
|
很多数组的传统方法会改变原数组,比如`push()`、`pop()`、`shift()`、`unshift()`等等。数组只要调用了这些方法,它的值就变了。[ES2023](https://github.com/tc39/proposal-change-array-by-copy)引入了四个新方法,对数组进行操作时,不改变原数组,而返回一个原数组的拷贝。
|
||||||
|
|
||||||
这样的方法一共有四个。
|
|
||||||
|
|
||||||
- `Array.prototype.toReversed() -> Array`
|
- `Array.prototype.toReversed() -> Array`
|
||||||
- `Array.prototype.toSorted(compareFn) -> Array`
|
- `Array.prototype.toSorted(compareFn) -> Array`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user