Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Number.toInteger()

已废弃 Gecko 33 (Firefox 33 / Thunderbird 33 / SeaMonkey 2.30)
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.

非标准
该特性是非标准的,请尽量不要在生产环境中使用它!

概览

Number.toInteger() 用来将参数转换成整数,但该方法的实现已被移除.

如果参数是 NaN, nullundefined, 会返回0 . 如果参数值是true返回1,false的话返回0.

语法

Number.toInteger(number)

参数

number
将被转换成证书的参数.

示例

例子: 使用 toInteger()方法

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

Specifications

  • Number.toInteger() 是ECMAScript 6 起草的一部分, 但在2013-8-23的Draft Rev 17 中被移除 .

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 Firefox 16 to 32 未实现 未实现 未实现
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 Firefox 16 to 32 未实现 未实现 未实现

See also

文档标签和贡献者

 此页面的贡献者: yenshen
 最后编辑者: yenshen,