Lodash _.isFinite() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is a finite primitive number. Based on Number.isFinite — no type coercion. 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 _.isFinite. Start with this line.

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

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

Library declarations
Lodash
_.isFinite(value)

Parameters

ParameterDescription
valueRequired. The value to check

Return Value

Return ValueDescription
*true if finite primitive number

Lodash Examples

Example 1 — Official: Basics

Finite numbers pass; Infinity and numeric strings fail.

Lodash
_.isFinite(3);
// → true

_.isFinite(Number.MIN_VALUE);
// → true

_.isFinite(Infinity);
// → false

_.isFinite("3");
// → false
Try It Yourself

How It Works

  1. 3 is a finite primitive → true.
  2. MIN_VALUE is a tiny finite float → true.
  3. Infinity is a number but not finite → false.
  4. "3" is a string — no coercion → false.

Example 2 — vs Global isFinite

Global isFinite coerces; Lodash does not.

Lodash
isFinite("3");
// → true   (coerces string → 3)

_.isFinite("3");
// → false

Number.isFinite("3");
// → false  (same idea as Lodash)
Try It Yourself

How It Works

  1. Global isFinite converts "3" to a number first.
  2. Lodash / Number.isFinite require typeof === "number".
  3. Result. Same string, different answers.
  4. Rule. Parse form strings yourself, then call _.isFinite.

Example 3 — NaN and -Infinity

Special IEEE values are numbers, but not finite.

Lodash
_.isFinite(NaN);
// → false

_.isFinite(-Infinity);
// → false

_.isNumber(NaN);
// → true   // still a number type

_.isFinite(-0);
// → true
Try It Yourself

How It Works

  1. NaN / -Infinity fail the finite test.
  2. isNumber(NaN) can still be true — different helper.
  3. -0 is a finite number → true.
  4. Use isFinite when math must stay in range.

Example 4 — Boxed Numbers and Booleans

Objects and booleans are not primitive numbers.

Lodash
_.isFinite(new Number(5));
// → false

_.isFinite(true);
// → false

isFinite(true);
// → true   // global coerces true → 1
Try It Yourself

How It Works

  1. new Number(5) is an object → Lodash false.
  2. true is a boolean → Lodash false.
  3. Global isFinite(true) coerces to 1 → true.
  4. Lesson. Strict checks avoid surprise coercions.

Example 5 — Safe Input Guard

Parse a string, then confirm the result is finite.

Lodash
function safeNumber(input) {
  var n = Number(input);
  return _.isFinite(n) ? n : null;
}

safeNumber("42");
// → 42

safeNumber("oops");
// → null

safeNumber("Infinity");
// → null
Try It Yourself

How It Works

  1. Number(input) converts the string deliberately.
  2. isFinite rejects NaN and Infinity.
  3. "42" → finite → return 42.
  4. Bad / Infinite inputs → null fallback.

Browser & Runtime Support

_.isFinite 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. Behavior aligns with Number.isFinite.

✓ Stable · Lodash 0.1.0+

_.isFinite()

Available in [email protected] full builds and the lodash/isFinite 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
_.isFinite Lodash 0.1.0+

Bottom line: Safe for production once Lodash is loaded. Prefer import isFinite from "lodash/isFinite". Native Number.isFinite is a fine alternative when Lodash is not needed.

Frequently Asked Questions

_.isFinite(value) returns true if value is a finite primitive number — not Infinity, -Infinity, or NaN, and not a coerced string.
Global isFinite coerces values (isFinite("3") is true). Lodash does not coerce — _.isFinite("3") is false. It follows Number.isFinite.
Yes for everyday inputs. Lodash documents that this method is based on Number.isFinite.
No. Boxed numbers have typeof "object". Lodash expects a primitive number.
Yes. Negative zero is still a finite number, so _.isFinite(-0) is true.
Use import isFinite from "lodash/isFinite" or require("lodash/isFinite") for tree-shaking. Full build: import _ from "lodash" then _.isFinite.

Next: _.isFunction()

Check whether a value is a function.

_.isFunction() 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