VOOZH about

URL: https://www.geeksforgeeks.org/javascript/collect-js-splice-method/

⇱ Collect.js splice() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Collect.js splice() Method

Last Updated : 14 Dec, 2020

The splice() method is used to  remove and returns a slice of items starting at the specified index

Syntax:

collect(array).splice()

Parameters: The collect() method takes one argument that is converted into the collection and then splice() method is applied on it.

Return Value: This method returns a slice of items starting at the specified index.

Below example illustrate the splice() method in collect.js:

Example 1:

Output:

[6, 5, 11, 3]
[8, 4, 7]

Example 2:

Output:

[5, 11, 3]
[8, 4, 7, 6]
Comment
Article Tags: