ES2023 added the Array with() method as a safe way to update elements in an array without altering the original array.
Exampleconst months = ["Januar", "Februar", "Mar", "April"];
const myMonths = months.with(2, "March");
The with()
method updates a specified array element.
The with()
method returns a new array.
The with()
method does not change the original array.
with()
is a JavaScript 2023 feature.
ES 2023 is supported in all modern browsers since July 2023:
Chrome❮ Previous JavaScript Array Reference Next ❯
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4