developer.mozilla.org
Open in
urlscan Pro
2600:9000:225e:c800:2:eb5:8c00:93a1
Public Scan
Submitted URL: https://mdn.io/Number/isInteger
Effective URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
Submission: On December 29 via api from US — Scanned from DE
Effective URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
Submission: On December 29 via api from US — Scanned from DE
Form analysis
1 forms found in the DOM/en-US/search
<form action="/en-US/search" role="search" aria-haspopup="listbox" aria-owns="top-nav-search-menu" aria-expanded="false" class="search-form search-widget" id="top-nav-search-form"><label id="top-nav-search-label" for="top-nav-search-input"
class="visually-hidden">Search MDN</label><input id="top-nav-search-input" aria-autocomplete="list" aria-controls="top-nav-search-menu" aria-labelledby="top-nav-search-label" autocomplete="off" type="search" class="search-input-field" name="q"
placeholder=" " required="" value=""><button type="button" class="button action has-icon clear-search-button"><span class="button-wrap"><span class="icon icon-cancel "></span><span class="visually-hidden">Clear search
input</span></span></button><button type="submit" class="button action has-icon search-button"><span class="button-wrap"><span class="icon icon-search "></span><span class="visually-hidden">Search</span></span></button>
<div id="top-nav-search-menu" role="listbox" aria-labelledby="top-nav-search-label"></div>
</form>
Text Content
* Skip to main content * Skip to search * Skip to select language MDN Plus now available in your country! Support MDN and make it your own. Learn more ✨ MDN Web DocsOpen main menu * ReferencesReferences * Overview / Web Technology Web technology reference for developers * HTML Structure of content on the web * CSS Code used to describe document style * JavaScript General-purpose scripting language * HTTP Protocol for transmitting web resources * Web APIs Interfaces for building web applications * Web Extensions Developing extensions for web browsers * Web Technology Web technology reference for developers * GuidesGuides * Overview / MDN Learning Area Learn web development * MDN Learning Area Learn web development * HTML Learn to structure web content with HTML * CSS Learn to style content using CSS * JavaScript Learn to run scripts in the browser * Accessibility Learn to make the web accessible to all * MDN PlusMDN Plus * Overview A customized MDN experience * New feature Updates All browser compatibility updates at a glance * Documentation Learn how to use MDN Plus * FAQ Frequently asked questions about MDN Plus Search MDNClear search inputSearch Theme * Already a subscriber? * Get MDN Plus 1. References 2. JavaScript 3. JavaScript 4. Standard built-in objects 5. Number 6. Number.isInteger() Article Actions * English (US) IN THIS ARTICLE * Try it * Syntax * Description * Examples * Specifications * Browser compatibility * See also RELATED TOPICS 1. Standard built-in objects 2. Number 3. Properties 1. Number.EPSILON 2. Number.MAX_SAFE_INTEGER 3. Number.MAX_VALUE 4. Number.MIN_SAFE_INTEGER 5. Number.MIN_VALUE 6. Number.NaN 7. Number.NEGATIVE_INFINITY 8. Number.POSITIVE_INFINITY 4. Methods 1. Number.isFinite() 2. Number.isInteger() 3. Number.isNaN() 4. Number.isSafeInteger() 5. Number.parseFloat() 6. Number.parseInt() 7. Number.prototype.toExponential() 8. Number.prototype.toFixed() 9. Number.prototype.toLocaleString() 10. Number.prototype.toPrecision() 11. Number.prototype.toString() 12. Number.prototype.valueOf() 5. Inheritance: 6. Function 7. Properties 1. Non-standard Deprecated Function.prototype.arguments 2. Non-standard Deprecated Function.prototype.caller 3. Non-standard Function.prototype.displayName 4. Function.prototype.length 5. Function.prototype.name 6. Function.prototype.prototype 8. Methods 1. Function.prototype.apply() 2. Function.prototype.bind() 3. Function.prototype.call() 4. Function.prototype.toString() 9. Object 10. Properties 1. Object.prototype.constructor 2. Deprecated Object.prototype.__proto__ 11. Methods 1. Deprecated Object.prototype.__defineGetter__() 2. Deprecated Object.prototype.__defineSetter__() 3. Deprecated Object.prototype.__lookupGetter__() 4. Deprecated Object.prototype.__lookupSetter__() 5. Object.prototype.hasOwnProperty() 6. Object.prototype.isPrototypeOf() 7. Object.prototype.propertyIsEnumerable() 8. Object.setPrototypeOf() 9. Object.prototype.toLocaleString() 10. Object.prototype.toString() 11. Object.prototype.valueOf() IN THIS ARTICLE * Try it * Syntax * Description * Examples * Specifications * Browser compatibility * See also NUMBER.ISINTEGER() The Number.isInteger() method determines whether the passed value is an integer. TRY IT SYNTAX Number.isInteger(value) Copy to Clipboard PARAMETERS value The value to be tested for being an integer. RETURN VALUE The boolean value true if the given value is an integer. Otherwise false. DESCRIPTION If the target value is an integer, return true, otherwise return false. If the value is NaN or Infinity, return false. The method will also return true for floating point numbers that can be represented as integer. It will always return false if the value is not a number. Note that some number literals, while looking like non-integers, actually represent integers — due to the precision limit of ECMAScript floating-point number encoding (IEEE-754). For example, 5.0000000000000001 only differs from 5 by 1e-16, which is too small to be represented. (For reference, Number.EPSILON stores the distance between 1 and the next representable floating-point number greater than 1, and that is about 2.22e-16.) Therefore, 5.0000000000000001 will be represented with the same encoding as 5, thus making Number.isInteger(5.0000000000000001) return true. In a similar sense, numbers around the magnitude of Number.MAX_SAFE_INTEGER will suffer from loss of precision and make Number.isInteger return true even when it's not an integer. (The actual threshold varies based on how many bits are needed to represent the decimal — for example, Number.isInteger(4500000000000000.1) is true, but Number.isInteger(4500000000000000.5) is false.) EXAMPLES USING ISINTEGER Number.isInteger(0); // true Number.isInteger(1); // true Number.isInteger(-100000); // true Number.isInteger(99999999999999999999999); // true Number.isInteger(0.1); // false Number.isInteger(Math.PI); // false Number.isInteger(NaN); // false Number.isInteger(Infinity); // false Number.isInteger(-Infinity); // false Number.isInteger("10"); // false Number.isInteger(true); // false Number.isInteger(false); // false Number.isInteger([1]); // false Number.isInteger(5.0); // true Number.isInteger(5.000000000000001); // false Number.isInteger(5.0000000000000001); // true, because of loss of precision Number.isInteger(4500000000000000.1); // true, because of loss of precision Copy to Clipboard SPECIFICATIONS SpecificationECMAScript Language Specification # sec-number.isinteger BROWSER COMPATIBILITY Report problems with this compatibility data on GitHub desktopmobileserver Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android Deno Node.js isInteger Full support Chrome34 Toggle history Full support Edge12 Toggle history Full support Firefox16 Toggle history Full support Opera21 Toggle history Full support Safari9 Toggle history Full support Chrome Android34 Toggle history Full support Firefox for Android16 Toggle history Full support Opera Android21 Toggle history Full support Safari on iOS9 Toggle history Full support Samsung Internet2.0 Toggle history Full support WebView Android37 Toggle history Full support Deno1.0 Toggle history Full support Node.js0.12.0 Toggle history LEGEND Tip: you can click/tap on a cell for more information. Full supportFull support The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. SEE ALSO * Polyfill of Number.isInteger in core-js * The Number object it belongs to. FOUND A PROBLEM WITH THIS PAGE? * Edit on GitHub * Source on GitHub * Report a problem with this content on GitHub * Want to fix the problem yourself? Learn how to contribute! Last modified: Dec 13, 2022, by MDN contributors MDN logo Your blueprint for a better internet. * MDN on Twitter * MDN on GitHub MDN * About * Hacks Blog * Careers SUPPORT * Product help * Report an issue OUR COMMUNITIES * MDN Community * MDN Forum * MDN Chat DEVELOPERS * Web Technologies * Learn Web Development * MDN Plus Mozilla logo * Website Privacy Notice * Cookies * Legal * Community Participation Guidelines Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation. Portions of this content are ©1998–2022 by individual mozilla.org contributors. Content available under a Creative Commons license.