Open In App

Lodash _.isFunction() Method

Last Updated : 04 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Lodash _.isFunction() Method checks whether the given value is a function object or not and returns the corresponding boolean value.

Syntax:

_.isFunction( value )

Parameters:

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

  • value: This parameter holds the value that to be checked for a function object.

Return Value:

  • This method returns a Boolean value(Returns true if the given value is Function object number, else false).

Example 1: In this example, the code defines a function and uses Lodash's _.isFunction method to check if the provided value is a function, and then it displays the result in the console.

JavaScript
// Defining Lodash variable 
const _ = require('lodash'); 

function Geeks(){
    let a="gfg";
}
// Checking for Function
console.log("The Value is Function : "
        + _.isFunction(Geeks));

Output:

The Value is Function : true

Example 2: In this example, the code utilizes Lodash's _.isFunction method to check if the provided value, which is a string ("Function"), is a function, and then displays the result in the console.

JavaScript
// Defining Lodash variable 
const _ = require('lodash'); 

// Checking for Function
console.log("The Value is Function : "
        + _.isFunction("Function"));

Output:

The Value is Function : false 

Example 3: In this example, the code defines a Lodash variable and uses Lodash's _.isFunction method to check if the provided value, which is the Lodash library itself, is a function, and then displays the result in the console.

For _ object, it returns true.

JavaScript
// Defining Lodash variable 
const _ = require('lodash'); 

// Checking for Function
console.log("The Value is Function : "
        + _.isFunction(_));

Output:

The Value is Function : true

Next Article

Similar Reads