aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/conflicting/web/javascript/reference/global_objects/number/index.html
blob: c9c453592deed41a2de7ef42ff9e185ea3393855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: Number.prototype
slug: conflicting/Web/JavaScript/Reference/Global_Objects/Number
translation_of: Web/JavaScript/Reference/Global_Objects/Number
translation_of_original: Web/JavaScript/Reference/Global_Objects/Number/prototype
original_slug: Web/JavaScript/Reference/Global_Objects/Number/prototype
---
<div>{{JSRef}}</div>

<p><strong><code>Number.prototype</code></strong> 屬性用來表示 {{jsxref("Number")}} 建構式的原型。</p>

<div>{{js_property_attributes(0, 0, 0)}}</div>

<h2 id="說明">說明</h2>

<p>所有 {{jsxref("Number")}} 實體都繼承自 <code>Number.prototype</code> 。{{jsxref("Number")}} 建構式的原型物件可以被修改並作用在所有 {{jsxref("Number")}} 實體。</p>

<h2 id="屬性">屬性</h2>

<dl>
 <dt><code>Number.prototype.constructor</code></dt>
 <dd>回傳建立這個物件實體的建構式。預設為 {{jsxref("Number")}} 物件。</dd>
</dl>

<h2 id="方法">方法</h2>

<dl>
 <dt>{{jsxref("Number.prototype.toExponential()")}}</dt>
 <dd>回傳以「科學記數法」表示的數值字串。</dd>
 <dt>{{jsxref("Number.prototype.toFixed()")}}</dt>
 <dd>回傳以定點表示的數值字串。</dd>
 <dt>{{jsxref("Number.prototype.toLocaleString()")}}</dt>
 <dd>回傳以當地語言為主的數值字串。這覆寫 {{jsxref("Object.prototype.toLocaleString()")}} 的方法。</dd>
 <dt>{{jsxref("Number.prototype.toPrecision()")}}</dt>
 <dd>回傳以定點或科學記數表示的數值字串。</dd>
 <dt>{{jsxref("Number.prototype.toSource()")}} {{non-standard_inline}}</dt>
 <dd>Returns an object literal representing the specified {{jsxref("Number")}} object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.</dd>
 <dt>{{jsxref("Number.prototype.toString()")}}</dt>
 <dd>回傳以特定基數表示的數值字串。這覆寫 {{jsxref("Object.prototype.toString()")}} 的方法 。</dd>
 <dt>{{jsxref("Number.prototype.valueOf()")}}</dt>
 <dd>回傳這個物件的原始型別,即原始數值。這覆寫 {{jsxref("Object.prototype.valueOf()")}}</dd>
</dl>

<h2 id="規範">規範</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">規範</th>
   <th scope="col">狀態</th>
   <th scope="col">註記</th>
  </tr>
  <tr>
   <td>{{SpecName('ES1')}}</td>
   <td>{{Spec2('ES1')}}</td>
   <td>Initial definition. Implemented in JavaScript 1.1.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.7.4', 'Number')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-properties-of-the-number-prototype-object', 'Number')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-properties-of-the-number-prototype-object', 'Number')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="瀏覽器相容性">瀏覽器相容性</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("javascript.builtins.Number.prototype")}}</p>

<h2 id="參見">參見</h2>

<ul>
 <li>{{jsxref("Number")}}</li>
</ul>