Skip to content
🧠 Master React Package Creation — Claim Your Spot

Number.isInteger() – How to Check If a Number Is an Integer

Number.isInteger() checks if its argument is an integer. If so, it returns true. Otherwise, the method returns false.

Number.isInteger() accepts only one required argument. Here is the syntax:

Number.isInteger(value);

The value argument represents the item you wish to test if it is an integer.

Below are examples of the Number.isInteger() method.

Number.isInteger(578);
// The invocation above will return: true

Try Editing It

Number.isInteger(0.99);
// The invocation above will return: false

Try Editing It

Number.isInteger("test");
// The invocation above will return: false

Try Editing It

Number.isInteger(-300);
// The invocation above will return: true

Try Editing It

Number.isInteger(0);
// The invocation above will return: true

Try Editing It

Number.isInteger(Math.PI);
// The invocation above will return: false

Try Editing It