Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!
This is a new technology, part of the ECMAScript 2015 (ES6) standard .
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.
The Number.isInteger() method determines whether the passed value is an integer.
Syntax
Number.isInteger(value)
Parameters
value- The value to be tested for being an integer.
Description
If the target value is an integer, return true, otherwise return false. If the value is NaN or infinite, return false.
Examples
Number.isInteger(0.1); // false
Number.isInteger(1); // true
Number.isInteger(Math.PI); // false
Number.isInteger(-100000); // true
Number.isInteger(NaN); // false
Number.isInteger(0); // true
Number.isInteger("10"); // false
Polyfill
Number.isInteger = Number.isInteger || function(value) {
return typeof value === "number" &&
isFinite(value) &&
Math.floor(value) === value;
};
Specifications
| Specification | Status | Comment |
|---|---|---|
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number.isInteger' in that specification. |
Standard | Initial definition. |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | 16 (16) | Not supported | (Yes) | Not supported |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | Not supported | Not supported | 16.0 (16) | Not supported | Not supported | Not supported |
See also
- The
Numberobject it belongs to.
Schlagwörter des Dokuments und Mitwirkende
Schlagwörter:
Mitwirkende an dieser Seite: SphinxKnight, Jeremie, ziyunfei, Mingun, realityking, fscholz, rvighne, kscarfone, fusionchess, Sheppy, ethertank
Zuletzt aktualisiert von:
SphinxKnight,