Number.prototype
屬性用來表示 Number
建構式的原型。
Property attributes of Number.prototype |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
說明
屬性
Number.prototype.constructor
- 回傳建立這個物件實體的建構式。預設為
Number
物件。
方法
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 theObject.prototype.toSource()
method. Number.prototype.toString()
- 回傳以特定基數表示的數值字串。這覆寫
Object.prototype.toString()
的方法 。 Number.prototype.valueOf()
- 回傳這個物件的原始型別,即原始數值。這覆寫
Object.prototype.valueOf()
。
規範
規範 | 狀態 | 註記 |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.1. |
ECMAScript 5.1 (ECMA-262) The definition of 'Number' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number' in that specification. |
Standard | |
ECMAScript (ECMA-262) The definition of 'Number' in that specification. |
Living Standard |
瀏覽器相容性
The compatibility table in 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.
No compatibility data found. Please contribute data for "javascript.builtins.Number.prototype" (depth: 1) to the MDN compatibility data repository.