How to use Lodash _.isString() Method In Javascript
In this approach, we are using the Lodah _.isString() method that returns boolean response for the given value.
Example: This example shows the implementation of above-explained appraoch.
// Requiring the lodash library
const _ = require("lodash");
// Use of _.isString() method
console.log(_.isString('w3wiki'));
console.log(_.isString(true));
Output:
true
false
Check if a variable is a string using JavaScript
In this article, we will check if a variable is a string using JavaScript. We can check the variable by using many methods.
Below are the following methods through which we can check the type of variable is a string:
Table of Content
- Using typeOf Operator
- Using Instanceof Operator
- Underscore.js _.isString()
- Using Lodash _.isString() Method
- Using Object.prototype.toString.call Method
Contact Us