Underscore.js _.isFunction() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Object

Definition

Returns true if object is a Function (official Underscore docs). Declarations, expressions, arrows, classes, and built-ins like alert all pass.

Pass the required arguments shown below. Underscore object helpers usually return a new value — check whether the source object is mutated.

Syntax

Call _.isFunction. Start with this line.

Underscore
_.isFunction(object)
CallWhat it does
_.isFunction(object)Primary signature.
_.isFunction(...)Call with the arguments your case needs.

Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.

Library declarations
Underscore
_.isFunction(object)

Parameters

ParameterDescription
objectRequired. Value to test

Return Value

Return ValueDescription
*true or false

Underscore.js Examples

Example 1 — Official Docs

A built-in function passes. A number does not.

Underscore
_.isFunction(alert);
// → true

_.isFunction(1);
// → false
Try It Yourself

How It Works

  1. alert. Built-in callable → true.
  2. 1. Number, not a Function → false.
  3. Job of the helper. Detect callables before you invoke them.
  4. Takeaway. Official docs use the browser alert API on purpose.

Example 2 — Function Kinds

Anonymous functions, named functions, and arrows all pass.

Underscore
console.log(_.isFunction(function () {}));       // true
console.log(_.isFunction(function named() {}));  // true
console.log(_.isFunction(() => {}));               // true
Try It Yourself

How It Works

  1. Anonymous. Classic function expression → passes.
  2. Named. Name does not change the type → passes.
  3. Arrow. Still a Function → passes.
  4. Rule. Syntax style does not matter — callability does.

Example 3 — vs typeof

In modern engines, _.isFunction and typeof usually agree.

Underscore
function greet() {}

console.log(_.isFunction(greet), typeof greet);     // true "function"
console.log(_.isFunction("greet"), typeof "greet"); // false "string"
Try It Yourself

How It Works

  1. greet. Function declaration → both report function.
  2. "greet". String → both report non-function.
  3. Why Underscore. Readable API that matches the rest of your Underscore code.
  4. Takeaway. Prefer one style in a project — consistency beats mixing.

Example 4 — vs _.isObject

Functions are objects. Not every object is a function.

Underscore
console.log(_.isFunction(function () {}), _.isObject(function () {})); // true true
console.log(_.isFunction({}), _.isObject({}));                         // false true
Try It Yourself

How It Works

  1. Function. Passes both — callables are objects in JS.
  2. Plain {}. Object yes, Function no.
  3. Pick the tool. Need a callable → isFunction.
  4. Related. See _.isObject for the broader check.

Browser & Runtime Support

_.isFunction ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.

✓ Stable · Underscore 1.x

_.isFunction()

Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded. The official example uses browser alert.

100% With Underscore 1.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.isFunction Underscore 1.x+

Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).

Frequently Asked Questions

_.isFunction(object) returns true only when the value is a Function — a function declaration, function expression, arrow function, class constructor, or similar callable. Strings, numbers, objects, and arrays return false.
_.isFunction(alert) returns true. alert is a built-in function in browsers, so Underscore treats it as a Function.
In modern engines they usually agree: typeof fn === "function". Underscore starts from a toString tag test and, when typeof is trustworthy, uses typeof obj == "function" for speed. Prefer _.isFunction for a readable Underscore-style check.
isObject is broader. Functions pass isObject because Underscore treats functions as objects. isFunction is the specific check when you need a callable.
Yes. Arrow functions, async functions, generator functions, and class constructors are all functions, so _.isFunction returns true.
No. It is a stable Underscore 1.x helper used throughout the library to decide whether a value can be called as an iteratee or callback.

Next: _.isString()

Detect string values — another core Underscore type check.

_.isString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful