Last Updated : 04 Sep, 2024
The _.isSymbol() method is used to find whether the given value is a symbol object or not. It returns True if the given value is a symbol object. Otherwise, it returns false.
Syntax:
_.isSymbol(value)
Parameters: This method accepts a single parameter as mentioned above and described below:
Return Value: This method returns true if the value is a symbol, else false.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.
JavaScript
// Requiring the lodash library
const _ = require("lodash");
// Use of _.isSymbol() method
console.log(_.isSymbol('geeksforgeeks'));
Output:
false
Example 2:
JavaScript
// Requiring the lodash library
const _ = require("lodash");
// Use of _.isSymbol() method
console.log(_.isSymbol(Symbol()));
Output:
true
Example 3:
JavaScript
// Requiring the lodash library
const _ = require("lodash");
// Use of _.isSymbol() method
console.log(_.isSymbol(Symbol.iterator));
Output:
true
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4