Underscore.js _.isFinite() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Object

Definition

Returns true if object is a finite Number (official Underscore docs). Infinity, -Infinity, and NaN return false.

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

Syntax

Call _.isFinite. Start with this line.

Underscore
_.isFinite(object)
CallWhat it does
_.isFinite(object)Primary signature.
_.isFinite(...)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
_.isFinite(object)

Parameters

ParameterDescription
objectRequired. Value to test

Return Value

Return ValueDescription
*true or false

Underscore.js Examples

Example 1 — Official Docs

A finite number passes. Negative Infinity does not.

Underscore
_.isFinite(-101);
// → true

_.isFinite(-Infinity);
// → false
Try It Yourself

How It Works

  1. -101. Finite integer → true.
  2. -Infinity. Not finite → false.
  3. Job of the helper. Keep usable numbers; reject infinities.
  4. Takeaway. Finite ≠ “is a Number type.”

Example 2 — Zero, Integers, and Floats

Everyday finite numbers all pass.

Underscore
console.log(_.isFinite(0));       // true
console.log(_.isFinite(123));     // true
console.log(_.isFinite(-12.44));  // true
Try It Yourself

How It Works

  1. Zero. Finite → passes.
  2. Positive integer. Finite → passes.
  3. Negative float. Still finite → passes.
  4. Rule. Sign and decimals do not matter — Infinity / NaN do.

Example 3 — vs _.isNumber

isNumber includes NaN and Infinity. isFinite does not.

Underscore
console.log(_.isFinite(42), _.isNumber(42));           // true true
console.log(_.isFinite(NaN), _.isNumber(NaN));         // false true
console.log(_.isFinite(Infinity), _.isNumber(Infinity)); // false true
Try It Yourself

How It Works

  1. 42. Finite Number → both pass.
  2. NaN. Number type, not finite → only isNumber passes.
  3. Infinity. Same split — type yes, finite no.
  4. Pick the tool. Type check vs usable numeric value.

Example 4 — Numeric Strings

Underscore treats "12" as finite. isNumber does not.

Underscore
console.log(_.isFinite("12"), _.isNumber("12")); // true false
console.log(_.isFinite("1a"));                   // false
console.log(_.isFinite(new Number(5)));          // true
Try It Yourself

How It Works

  1. "12". Parses as a finite number → isFinite true.
  2. isNumber. Strings are not Number type → false.
  3. "1a". Not a clean numeric string → false.
  4. Boxed Number. new Number(5) still passes.

Browser & Runtime Support

_.isFinite 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

_.isFinite()

Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.

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
_.isFinite 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

_.isFinite(object) returns true when the value is a finite number — integers, floats, 0, negatives, boxed new Number() objects, and numeric strings such as "12". Infinity, -Infinity, NaN, null, and empty strings return false.
_.isFinite(-101) returns true. _.isFinite(-Infinity) returns false. That pair shows the helper’s job: keep real finite values, reject infinities.
isNumber is a type check and includes NaN and Infinity. isFinite asks whether the value is finite. NaN and Infinity pass isNumber and fail isFinite. Numeric strings such as "12" fail isNumber and pass isFinite.
Both reject Infinity and NaN. Native isFinite(null) is true because null coerces to 0. Underscore also requires parseFloat(obj) not to be NaN, so null and "" fail. Numeric strings such as "12" still pass both.
Yes. Underscore’s tests say numeric strings are numbers: _.isFinite("12") is true. Non-numeric strings such as "1a" and empty "" are false.
No. It is a stable Underscore 1.x helper used to decide whether a value is a finite number before you do arithmetic.

Next: _.isBoolean()

Detect true and false — another core Underscore type check.

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