JS: 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 JS: Value 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. JS: Format Number
  2. JS: String to Number
  3. JS: Number Object
  4. JS: Number Constructor
  5. JS: Number.prototype
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc