VOOZH about

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

⇱ Collect.js split() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Collect.js split() Method

Last Updated : 3 Dec, 2020

The split() method in collect.js is used to break a collection into the given number of groups.

Syntax:

collect(array).split()

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

Return Value: This method returns a collection that is made by splitting the main collection.

Below examples illustrates the split() method in collect.js:

Example 1:


Output:

[[1, 2], [3, 4], [5, 6], [7]]

Example 2:


Output:

[[['c', 'c++']], [['java']], [['python', 'c#']]]
Comment
Article Tags: