JavaScript Number.isInteger() Method

You are Here:

JavaScript Number.isInteger() Method

The Number.isInteger() method returns a Boolean value indicates whether the passed value is an integer.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> var result = Number.isInteger(1.5); document.write(result); </script> </body> </html>

Syntax

Number.isInteger(value)

Parameter Values

ValueTypeExplanation
valueRequiredThe value to be tested for being an integer.

Return Value

ValueExplanation
trueIf the given value is integer.
falseIf the given value is not an integer.

More Examples

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> document.write(Number.isInteger(0) +": 0 <br>"); document.write(Number.isInteger(1) +": 1 <br>"); document.write(Number.isInteger(-25) +": -25 <br>"); document.write(Number.isInteger(99999999999) +": 99999999999 <br><br>"); document.write(Number.isInteger(true) +": true <br>"); document.write(Number.isInteger(false) +": false <br>"); document.write(Number.isInteger('65') +": '65' <br>"); document.write(Number.isInteger(1.5) +": 1.5 <br>"); document.write(Number.isInteger([5]) +": [5] <br>"); document.write(Number.isInteger(NaN) +": NaN <br>"); document.write(Number.isInteger(Infinity) +": Infinity <br>"); document.write(Number.isInteger(-Infinity) +": -Infinity <br>"); document.write(Number.isInteger(null) +": null <br>"); </script> </body> </html>

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author