概述
Number.prototype 属性表示 Number 构造函数的原型。
Number.prototype 属性的属性特性: |
|
|---|---|
| writable | false |
| enumerable | false |
| configurable | false |
描述
所有 Number 实例都继承自 Number.prototype。修改 Number 构造函数的原型对象会影响到所有 Number 实例。.
属性
- constructor
-
返回创建该实例对象的构造函数。默认为
Number对象。
Properties inherited from
Object:
方法
-
Number.prototype.toExponential() - 返回一个使用指数表示法表示的该数值的字符串表示。
-
Number.prototype.toFixed() - 返回一个使用定点表示法表示的该数值的字符串表示。
-
Number.prototype.toLocaleString() -
返回一个与语言相关的该数值对象的字符串表示。覆盖了
Object.prototype.toLocaleString()方法。 -
Number.prototype.toPrecision() - 使用定点表示法或指数表示法来表示的指定显示位数的该数值对象的字符串表示。
-
Number.prototype.toSource() -
Returns an object literal representing the specified Number object; you can use this value to create a new object. Overrides the
Object.prototype.toSource()method. -
Number.prototype.toString() -
返回一个表示该数值对象的字符串。覆盖了
Object.prototype.toString()方法。 -
Number.prototype.valueOf() -
返回该数值对象的原始值。覆盖了
Object.prototype.valueOf()方法。
Methods inherited from
Object:
规范
| 规范版本 | 规范状态 | 注解 |
|---|---|---|
| ECMAScript 1st Edition. Implemented in JavaScript 1.1 | Standard | Initial definition. |
| ECMAScript 5.1 (ECMA-262) Number |
Standard | |
| ECMAScript 2015 (6th Edition, ECMA-262) Number |
Standard |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains.
Find out how you can help!
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |