Open In App
Related Articles

Lodash _.isString() Method

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Lodash _.isString() method is used to find whether the given value is a string object or not. It returns True if the given value is a string. Otherwise, it returns false.  

Syntax:

_.isString(value);

Parameters:

  • value: This parameter holds the value to check.

Return Value:

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

Example 1: In this example, we are checking whether the given value is a string or not, if it is a string then it is giving us true value.

Javascript

// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.isString() method
console.log(_.isString('GeeksforGeeks'));
console.log(_.isString(true));

                    

Output:

true
false

Example 2: In this example, we are checking whether the given value is a string or not, if it is a string then it is giving us true value.

Javascript

// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.isString() method
console.log(_.isString('123'));
console.log(_.isString(123));
console.log(_.isString("0.123"));

                    

 Output:

true
false
true

Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!


Last Updated : 03 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials