Open In App

Lodash _.isWeakSet() Method

Last Updated : 03 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Lodash _.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 weak object. Otherwise, it returns false.

Syntax:

_.isWeakSet(value);

Parameters:

  • value: This parameter holds the value to check.

Return Value:

This method returns true if the value is a weak set, else false.

Example 1: In this example, we are checking whether the given value is a weak set or not and printing the output accordingly.

Javascript




// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.isWeakSet() method
console.log(_.isWeakSet(new Set));


Output:

false

Example 2: In this example, we are checking whether the given value is a weak set or not and printing the output accordingly.

Javascript




// Requiring the lodash library 
const _ = require("lodash"); 
     
// Use of _.isWeakSet() method
console.log(_.isWeakSet(new WeakSet));


 Output:

true

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads