Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.isWeakSet() method is used to find whether the given value is a weakset object or not. It returns true if the given value is a weakset object. Otherwise, it returns false.
Syntax:
_.isWeakSet( value )
Parameters: This method accepts a single parameter as mentioned above and described below:
- value: This parameter holds the value to check.
Return Value: This method returns true if value is a weak set, else false.
Example 1:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.isWeakSet() method console.log(_.isWeakSet( new Set)); |
Output:
false
Example 2:
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.isWeakSet() method console.log(_.isWeakSet( new WeakSet)); |
Output:
true