Wednesday, July 3, 2024
HomeLanguagesJavascriptLodash _.isError() Method

Lodash _.isError() Method

The Lodash _.isError() Method checks whether the given value is a type of error or not and returns the corresponding boolean value.

Syntax:

_.isError( value )

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

  • value: This parameter holds the value to be checked for error.

Return Value: This method returns a Boolean value(Returns true if the given values is an error, else false).

Example 1: 

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
// Checking for Error Value 
console.log("The Value is Error : "
        + _.isError(new Error));


Output:

The Value is Error : true

Example 2: 

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
// Checking for Error Value 
console.log("The Value is Error : "
        +_.isError("Err"));


Output:

The Value is Error : false 

Calisto Chipfumbu
Calisto Chipfumbuhttp://cchipfumbu@gmail.com
I have 5 years' worth of experience in the IT industry, primarily focused on Linux and Database administration. In those years, apart from learning significant technical knowledge, I also became comfortable working in a professional team and adapting to my environment, as I switched through 3 roles in that time.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments