Favorites

JavaScript Number.isInteger() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Number.isInteger()
JavaScript Number Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

The Number.isInteger() static method checks whether a value is a whole number.

Description

The Number.isInteger() static method determines whether the value is an integer. Numbers like 5.0 count, because JavaScript doesn't distinguish them from 5. Strings, NaN and Infinity return false.

Very large numbers are always integers in floating point, so Number.isInteger(1e300) is true, even though the value can't be represented exactly. Use Number.isSafeInteger() when you need to be sure every digit is correct, such as for IDs.

It's handy for validating input, such as quantities that must be whole numbers, after converting the input with Number(). Like other static members of Number, it is called on the Number constructor itself, not on individual number values.

Syntax

Number.isInteger(value)

Parameters

  • valueThe value to check.

Return Value

true if the value is an integer, otherwise false.

Example

console.log(Number.isInteger(5));
console.log(Number.isInteger(5.0));
console.log(Number.isInteger(5.5));
console.log(Number.isInteger('5'));

Browser Support

The following information will show you the current browser support for the Number.isInteger() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee