JavaScript: Number.isFinite

By Xah Lee. Date: . Last updated: .

Number.isFinite ( number )

  1. If type of number is not number, return false.
  2. If number is NaN, +Infinity, or -Infinity, return false.
  3. Else, return true.

〔►see JavaScript: Data Types

console.log ( Number.isFinite ( 3 ) ); // true
console.log ( Number.isFinite ( 3.4 ) ); // true

console.log ( Number.isFinite ( "3" ) ); // false
console.log ( Number.isFinite ( Infinity ) ); // false
console.log ( Number.isFinite ( NaN ) ); // true

Reference

ECMAScript® 2016 Language Specification#sec-number.isfinite

Number Topic


  1. JavaScript: Number Object
  2. JavaScript: Number Constructor
  3. JavaScript: Number.prototype
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.