Underscore.js _.isString() Function (original) (raw)

Last Updated : 01 Aug, 2023

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:

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: 'GeeksforGeeks',

`` Address: 'Noida',

`` Contact: '+91 9876543210'

`` };

`` console.log(_.isString(info));

`` var str = 'GeeksforGeeks';

`` console.log(_.isString(str));

`` </ script >

</ body >

</ html >

Output:

Example 2:

Output:

Similar Reads