Collect.js pop() Method Last Updated : 30 Nov, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The pop() method is used to remove the last element from collection and returns the popped element. Syntax: collect(array).pop() Parameters: The collect() method takes one argument that is converted into the collection and then pop() method is applied on it. Return Value: This method returns the popped element from given collection. Below example illustrate the pop() method in collect.js: Example 1: JavaScript const collect = require('collect.js'); const collection = collect(['Geeks', 'GFG', 'GeeksforGeeks']); console.log("Popped Elements: " + collection.pop()); console.log("Collection Elements: " + collection.all()); Output: Popped Elements: GeeksforGeeks Collection Elements: Geeks,GFG Example 2: JavaScript const collect = require('collect.js'); let obj = [ { name: 'Rahul', dob: '25-10-96' }, { name: 'Aditya', dob: '25-10-96' }, { name: 'Abhishek', dob: '16-08-94' } ]; const collection = collect(obj); console.log("Popped Element"); console.log(collection.pop()); console.log("Collection Elements"); console.log(collection.all()); Output: Popped Element { name: 'Abhishek', dob: '16-08-94' } Collection Elements [ { name: 'Rahul', dob: '25-10-96' }, { name: 'Aditya', dob: '25-10-96' } ] Comment More infoAdvertise with us Next Article Collect.js put() Method A ashokjaiswal Follow Improve Article Tags : JavaScript Web Technologies Collect.js Similar Reads Collect.js pipe() Method The pipe() method is used to hold a callback function and apply this function into the collection and returns the corresponding result. Syntax: collect(array).pipe(callback)Parameters: The collect() method takes one argument that is converted into the collection and then the pipe() method is applied 2 min read Collect.js put() Method The put() method is used to set the given key and value in the collection. Syntax: collect(array).put(key) Parameters: The collect() method takes one argument that is converted into the collection and then put() method is applied on it. The put() method holds the key as parameter. Below example illu 1 min read Collect.js pad() Method The pad() method is used to fill the array with the given element until the size of the array is full. We use a negative size to pad the elements left side and use a positive sign to pad elements right side. If the array size is full then no padding will perform. Syntax: collect(array).pad(size, val 2 min read Collect.js pull() Method The pull() method is used to remove an element from collection by given key and return the pulled element. Syntax: collect(array).pull(key) Parameters: The collect() method takes one argument that is converted into the collection and then pull() method is applied on it. The pull() method holds the k 1 min read Collect.js only() Method The only() method is used to return the items from the given collection with the specified keys. It takes the key as a parameter and returns the item mapped with that key. Syntax: collect(array).only(key)Parameters: The collect() method takes one argument that is converted into the collection and th 2 min read Collect.js skip() Method The skip() method is used to skip the given number of elements from collection and returns the remaining collection elements. Syntax: collect(array).skip(size) Parameters: The collect() method takes one argument that is converted into the collection and then skip() method is applied on it. The skip( 1 min read Like