Underscore.JS - isFunction method



Syntax

_.isFunction(object)

isFunction method checks if object is a function object. See the below example −

Example

var _ = require('underscore');

//Example 1: Check if argument passed is a function
console.log(_.isFunction(console.log));

//Example 2: Check if argument passed is a function
console.log(_.isArguments([1]));

Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

Output

true
false
underscorejs_comparing_objects.htm
Advertisements