← Back to release summary

Methods that change Array and TypedArray by copy

Category
JavaScript
Type
Chromium catches up
Status
Enabled by default (Chrome 110)
Intent stage
Dev trials

WPT details: In test262: see https://github.com/tc39/test262/pull/3464

Summary

Provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.

Motivation

Existing Array.prototype and TypedArray.prototype methods modify the receiver in-place. These new methods improve DX by providing alternatives that return modified copies of the receiver array, leaving the original unchanged. These new methods are useful in a programming style that encourages use of immutable data.

Standards & signals

Ecosystem

Explainers: https://github.com/tc39/proposal-change-array-by-copy

View on chromestatus.com