Favorites

JavaScript Array.prototype.toSpliced() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.toSpliced()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The toSpliced() method returns a copy of an array with elements removed, replaced or inserted, leaving the original unchanged.

Description

The toSpliced() method is the copying version of splice(). Instead of changing the array and returning the removed elements, it returns a new array with the change made, and the original stays as it was.

It takes the same arguments as splice(): a start index (negative values count from the end), the number of elements to remove, and any elements to insert. Unlike splice(), it doesn't tell you which elements were removed; if you need them, use slice() on the original.

It's useful for immutable updates, such as removing an item from a list in framework state: items.toSpliced(index, 1). The result is never sparse, as empty slots become undefined, and like the other copying methods it makes a shallow copy.

Syntax

array.toSpliced(start, deleteCount, item1, item2, ...)

Parameters

  • startThe index to start at.
  • deleteCountOptional. How many elements to remove.
  • item1, item2, ...Optional. Elements to insert.

Return Value

A new array with the changes applied.

Example

const letters = ['a', 'b', 'c', 'd'];
console.log(letters.toSpliced(1, 2));
console.log(letters.toSpliced(1, 0, 'x'));
console.log(letters);

Browser Support

The following information will show you the current browser support for the Array.prototype.toSpliced() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee