Array.prototype.splice()
Array.prototype.splice() is a JavaScript method in the Array category. Changes array contents by removing or replacing existing elements. The syntax is array.splice(start, deleteCount, item1, ..., itemN). It returns An array of deleted elements. A typical example: [1, 2, 3, 4].splice(1, 2, 99) // [1, 99, 4]. Its time complexity is O(n), which matters when it runs over large inputs. The TypeScript signature is (start: number, deleteCount?: number, ...items: T[]): T[]. A close sibling is Array.prototype.map(), which creates a new array populated with the results of calling a provided function on every element. A close sibling is Array.prototype.filter(), which creates a new array with all elements that pass the test implemented by the provided function. A close sibling is Array.prototype.reduce(), which executes a reducer function on each element, resulting in a single output value. A close sibling is Array.prototype.forEach(), which executes a provided function once for each array element.