TypeScript Array splice() - TypeScript

What is TypeScript - Array splice()?

splice() method changes the content of an array, adding new elements while removing old elements.

Syntax

Parameter Details

  • index − Index at which to start changing the array.
  • howMany − An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed.
  • element1, ..., elementN − The elements to add to the array. If you don't specify any elements, splice simply removes the elements from the array.

Return Value

Returns the extracted array based on the passed parameters.

Example

On compiling, it will generate the same code in JavaScript.

Its output is as follows −

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

TypeScript Topics