JS: Number.isInteger

By Xah Lee. Date: .

Number.isInteger ( number )

Return true if number is a integer.

console.log ( Number.isInteger ( 0 ) ); // true
console.log ( Number.isInteger ( 0.0000 ) ); // true

console.log ( Number.isInteger ( 0.00000000000000001 ) ); // false
console.log ( Number.isInteger ( Infinity ) ); // false
console.log ( Number.isInteger ( NaN ) ); // false

console.log ( Number.isInteger ( new Number (3) ) ); // false
console.log ( Number.isInteger ( new Number (3).valueOf ( ) ) ); // true

JS Number

  1. Format Number
  2. String to Number
  3. Random Number

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

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

Web Dev Tutorials