Lodash _.isFunction() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is classified as a Function object. Callables pass; RegExp and plain objects do not. Since Lodash 0.1.0.

Pass the value you want to inspect or convert. Read the return type carefully before you use the result.

Syntax

Call _.isFunction. Start with this line.

Lodash
_.isFunction(value)
CallWhat it does
_.isFunction(value)Primary signature.

Prefer import isFunction from "lodash/isFunction" when you want a smaller bundle.

Library declarations
Lodash
_.isFunction(value)

Parameters

ParameterDescription
valueRequired. The value to check

Return Value

Return ValueDescription
*true if Function object, else false

Lodash Examples

Example 1 — Official: Lodash vs RegExp

The library object is a function; a regex is not.

Lodash
_.isFunction(_);
// → true

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

How It Works

  1. _ is the Lodash function object.
  2. isFunction sees a Function tag → true.
  3. /abc/ is a RegExp → different tag → false.
  4. Lesson. Callable ≠ “looks like a pattern object.”

Example 2 — Declarations, Arrows, and Classes

Common callable shapes all return true.

Lodash
function greet() {}
var arrow = () => {};
class Person {}

_.isFunction(greet);
// → true

_.isFunction(arrow);
// → true

_.isFunction(Person);
// → true
Try It Yourself

How It Works

  1. greet is a classic function declaration.
  2. arrow is still a Function object.
  3. Person is a class constructor — callable → true.
  4. Note. Instances (new Person()) are objects, not functions.

Example 3 — Async and Generator Functions

Modern function kinds still count as functions.

Lodash
async function load() {}
function* gen() { yield 1; }

_.isFunction(load);
// → true

_.isFunction(gen);
// → true

_.isFunction(gen());
// → false  // the iterator object, not the function
Try It Yourself

How It Works

  1. async function has an AsyncFunction tag → true.
  2. function* has a GeneratorFunction tag → true.
  3. gen() returns an iterator object → false.
  4. Tip. Check the function, not the result of calling it.

Example 4 — Non-Functions

Objects, strings, and null are not callables.

Lodash
_.isFunction({});
// → false

_.isFunction("fn");
// → false

_.isFunction(null);
// → false

_.isFunction(Math);
// → false  // object with methods, not a function itself
Try It Yourself

How It Works

  1. Plain object / string / null lack Function tags.
  2. Math is an object namespace — check Math.max instead.
  3. All four return false.
  4. Guard before calling optional callbacks.

Example 5 — Optional Callback Guard

Invoke a hook only when it is actually a function.

Lodash
function run(onReady) {
  if (_.isFunction(onReady)) {
    return onReady("ok");
  }
  return "skipped";
}

run(function (msg) { return "got " + msg; });
// → "got ok"

run(null);
// → "skipped"
Try It Yourself

How It Works

  1. isFunction guards the call site.
  2. Real callback runs and returns a string.
  3. null fails the check → default path.
  4. Use case. Options APIs with optional hooks.

Browser & Runtime Support

_.isFunction is a Lodash Lang helper (since 0.1.0). It runs anywhere Lodash 4.x runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 0.1.0+

_.isFunction()

Available in [email protected] full builds and the lodash/isFunction modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.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 Lodash 0.1.0+

Bottom line: Safe for production once Lodash is loaded. Prefer import isFunction from "lodash/isFunction". typeof value === "function" is a fine native alternative for most apps.

Frequently Asked Questions

_.isFunction(value) returns true if value is classified as a Function object, otherwise false.
Yes. Arrows, async functions, and generators are all treated as functions.
A class declaration creates a callable constructor function, so Lodash returns true.
No. _.isFunction(/abc/) is false — that is the official contrast example.
They usually agree. Lodash uses internal tags for consistent classification across engines and function kinds.
Use import isFunction from "lodash/isFunction" or require("lodash/isFunction") for tree-shaking. Full build: import _ from "lodash" then _.isFunction.

Next: _.isInteger()

Check whether a value is an integer.

_.isInteger() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

11 people found this page helpful