@@ -841,14 +841,16 @@ console.log(newArray); // => ["A", "B2", "C"]
841841
842842次の表では、破壊的な方法に対応する非破壊的な方法をまとめています。
843843
844+ <!-- TODO: to~のメソッドはMDNのページに日本語がないためen-USになっている) -->
845+
844846| 破壊的な方法 | 非破壊な方法 |
845847| ---------------------------------------- | ------------- |
846848| ` array[index] = item ` | [ ` Array.prototype.with ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/with ) <sup >[ ES2023] </sup > |
847849| [ ` Array.prototype.pop ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/pop ) | [ ` array.slice(0, -1) ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/slice ) と[ ` array.at(-1) ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/at ) <sup >[ ES2022] </sup > |
848850| [ ` Array.prototype.push ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/push ) | ` [...array, item] ` <sup >[ ES2015] </sup > |
849- | [ ` Array.prototype.splice ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/splice ) | [ ` Array.prototype.toSpliced ` ] ( https://developer.mozilla.org/ja /docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced ) <sup >[ ES2023] </sup > |
850- | [ ` Array.prototype.reverse ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse ) | [ ` Array.prototype.toReversed ` ] ( https://developer.mozilla.org/ja /docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed ) <sup >[ ES2023] </sup > |
851- | [ ` Array.prototype.sort ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/sort ) | [ ` Array.prototype.toSorted ` ] ( https://developer.mozilla.org/ja /docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted ) <sup >[ ES2023] </sup > |
851+ | [ ` Array.prototype.splice ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/splice ) | [ ` Array.prototype.toSpliced ` ] ( https://developer.mozilla.org/en-US /docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced ) <sup >[ ES2023] </sup > |
852+ | [ ` Array.prototype.reverse ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse ) | [ ` Array.prototype.toReversed ` ] ( https://developer.mozilla.org/en-US /docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed ) <sup >[ ES2023] </sup > |
853+ | [ ` Array.prototype.sort ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/sort ) | [ ` Array.prototype.toSorted ` ] ( https://developer.mozilla.org/en-US /docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted ) <sup >[ ES2023] </sup > |
852854| [ ` Array.prototype.shift ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/shift ) | [ ` array.slice(1) ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/slice ) と[ ` array.at(0) ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/at ) <sup >[ ES2022] </sup > |
853855| [ ` Array.prototype.unshift ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift ) | ` [item, ...array] ` <sup >[ ES2015] </sup > |
854856| [ ` Array.prototype.copyWithin ` ] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin ) <sup >[ ES2015] </sup > | なし |
0 commit comments