We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The Number.toInteger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed.

If the target value is NaN, null or undefined, 0 is returned. If the target value is false, 0 is returned and if true, 1 is returned.




The value to be converted to an integer.


Using toInteger

Number.toInteger(0.1);     // 0
Number.toInteger(1);       // 1
Number.toInteger(Math.PI); // 3
Number.toInteger(null);    // 0


Number.toInteger() was part of the draft ECMAScript 6 specification, but has been removed on August 23, 2013 in Draft Rev 17.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No No16 — 32 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support No No No16 — 32 No No No

See also

Document Tags and Contributors

 Contributors to this page: fscholz, Mingun, teoli
 Last updated by: fscholz,