Thursday, November 13, 2025
HomeLanguagesJavascriptUnderscore.js _.isString() Function

Underscore.js _.isString() Function

The _.isString() function is used to check whether the given object element is string or not.

Syntax:

_.isString( object )

Parameters: This function accepts single parameter as mentioned above and described below:

  • object: It contains the value of object that need to be check whether it is an string or not.

Return Value: It returns a Boolean value True if given object element is string, False otherwise.

Example 1:




<!DOCTYPE html>
<html>
  
<head>
    <script type="text/javascript" 
            src=
    </script>
</head>
  
<body>
    <script type="text/javascript">
  
        var info = {
            Company: 'neveropen',
            Address: 'Noida',
            Contact: '+91 9876543210'
        };
        console.log(_.isString(info));
  
        var str = 'neveropen';
        console.log(_.isString(str));
    </script>
</body>
  
</html>


Output:

Example 2:




<!DOCTYPE html>
<html>
  
<head>
    <script type="text/javascript" 
            src=
    </script>
</head>
  
<body>
    <script type="text/javascript">
  
        console.log(_.isString(true));
        console.log(_.isString(10));
        console.log(_.isString('neveropen'));
        console.log(_.isString("20"));
    </script>
</body>
  
</html>


Output:

RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6837 POSTS0 COMMENTS
Umr Jansen
6839 POSTS0 COMMENTS