The isEmpty() method is used to check the given collection is empty or not and returns the corresponding boolean value.
Syntax:
collect(array).isEmpty()
Parameters: The collect() method takes one argument that is converted into the collection and then isEmpty() method is applied on it.
Return Value: This method checks the given collection is empty or not and returns the corresponding boolean value.
Below example illustrate the isEmpty() method in collect.js:
Example 1:
const collect = require('collect.js'); let arr = []; const collection = collect(arr); const isemp = collection.isEmpty(); console.log(isemp); |
Output:
true
Example 2:
const collect = require('collect.js'); const collection = collect({}); const isemp1 = collection.isEmpty(); console.log(isemp1); const collection1 = collect([10, 20, 30]); const isemp2 = collection1.isEmpty(); console.log(isemp2); |
Output:
true false

… [Trackback]
[…] Find More Info here on that Topic: geeksforgeeks.org/collect-js-isempty-method-2/ […]
… [Trackback]
[…] There you will find 10261 more Information to that Topic: geeksforgeeks.org/collect-js-isempty-method-2/ […]
… [Trackback]
[…] There you will find 53920 more Info to that Topic: geeksforgeeks.org/collect-js-isempty-method-2/ […]
… [Trackback]
[…] Information to that Topic: geeksforgeeks.org/collect-js-isempty-method-2/ […]
… [Trackback]
[…] Find More Information here to that Topic: geeksforgeeks.org/collect-js-isempty-method-2/ […]