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:

