diff options
Diffstat (limited to 'files/zh-tw/web/javascript/reference/global_objects')
49 files changed, 192 insertions, 2188 deletions
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html index c8fc9a7aca..45730b8fad 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html @@ -44,7 +44,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/concat <li>資料型態為字串、數值或是布林(非 {{jsxref("Global_Objects/String", "String")}}、{{jsxref("Global_Objects/Number", "Number")}} 及 {{jsxref("Global_Objects/Boolean", "Boolean")}} 物件):<code>concat</code> 複製字串及數值的值到新的陣列。</li> </ul> -<div class="note"> +<div class="notecard note"> <p><strong>備註:</strong>合併(多個)陣列/(多個)值將讓原始的陣列不會被受到影響。此外,任何對新陣列(只有在元素不是物件參考的情況下)的操作都不會影響原始的陣列,反之亦然。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html index df1dc91684..d1f4b27a23 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html @@ -66,8 +66,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/forEach <p><code>forEach()</code> does not mutate the array on which it is called (although <code>callback</code>, if invoked, may do so).</p> -<div class="note"> -<p>除非是拋出異常,否則並沒有中止 <code>forEach()</code> 迴圈的辦法。如果你需要這樣做,<code>forEach()</code> 就是錯誤的用法,相反的,應該要用簡單的迴圈。如果你要測試陣列裡面的元素並回傳布林值,可以用 {{jsxref("Array.prototype.every()", "every()")}} 或 {{jsxref("Array.prototype.some()", "some()")}}。如果可以的話,新的方法 {{jsxref("Array.prototype.find()", "find()")}} 或 {{jsxref("Array.prototype.findIndex()", "findIndex()")}} 也可以用於 true 值之後提前終止。</p> +<div class="notecard note"> +<p><strong>備註:</strong>除非是拋出異常,否則並沒有中止 <code>forEach()</code> 迴圈的辦法。如果你需要這樣做,<code>forEach()</code> 就是錯誤的用法,相反的,應該要用簡單的迴圈。如果你要測試陣列裡面的元素並回傳布林值,可以用 {{jsxref("Array.prototype.every()", "every()")}} 或 {{jsxref("Array.prototype.some()", "some()")}}。如果可以的話,新的方法 {{jsxref("Array.prototype.find()", "find()")}} 或 {{jsxref("Array.prototype.findIndex()", "findIndex()")}} 也可以用於 true 值之後提前終止。</p> </div> <h2 id="範例">範例</h2> @@ -140,8 +140,8 @@ obj.sum; <p>Since the <code>thisArg</code> parameter (<code>this</code>) is provided to <code>forEach()</code>, it is passed to <code>callback</code> each time it's invoked, for use as its <code>this</code> value.</p> -<div class="note"> -<p>If passing the function argument using an <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function expression</a> the <code>thisArg</code> parameter can be omitted as arrow functions lexically bind the {{jsxref("Operators/this", "this")}} value.</p> +<div class="notecard note"> +<p><strong>Note:</strong> If passing the function argument using an <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function expression</a> the <code>thisArg</code> parameter can be omitted as arrow functions lexically bind the {{jsxref("Operators/this", "this")}} value.</p> </div> <h3 id="An_object_copy_function">An object copy function</h3> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/index.html index f6c64c360c..112a5d1e21 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/index.html @@ -215,12 +215,12 @@ var myArray = myRe.exec('cdbBdbsbz'); <p>這項比對結果的屬性與元素參考如下:</p> -<table class="fullwidth-table"> +<table> <tbody> <tr> - <td class="header">屬性/元素</td> - <td class="header">說明</td> - <td class="header">範例</td> + <th>屬性/元素</th> + <th>說明</th> + <th>範例</th> </tr> <tr> <td><code>input</code></td> @@ -292,8 +292,8 @@ var myArray = myRe.exec('cdbBdbsbz'); <h2 id="Array_泛型方法"><code>Array</code> 泛型方法</h2> -<div class="warning"> -<p><strong>泛型陣列並非標準且已被棄用,將會在不久之後被去除。</strong> </p> +<div class="notecard warning"> +<p><strong>警告:</strong>泛型陣列並非標準且已被棄用,將會在不久之後被去除。</p> </div> <p>有時你想將陣列方法用於字串或其他類陣列物件(像是函數 {{jsxref("Functions/arguments", "arguments", "", 1)}})。藉此操作,你將此字串視為由字元組成的陣列(反之為將其他非陣列視為物件)。如範例,若要確認字串中的每個字元是不是字母,你可能會這樣寫:</p> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html index ff6bbdba76..960e15896d 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/indexOf <p><code><strong>indexOf()</strong></code> 方法會回傳給定元素於陣列中第一個被找到之索引,若不存在於陣列中則回傳 -1。</p> -<div class="note"> +<div class="notecard note"> <p><strong>備註:</strong>若是調用字串的方法,請參閱 {{jsxref("String.prototype.indexOf()")}}。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html index 1f943d8dfa..b2caccdef9 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html @@ -58,7 +58,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/Reduce <p>當回呼函式第一次被呼叫時,<code>accumulator</code> 與 <code>currentValue</code> 的值可能為兩種不同的狀況:若在呼叫 <code>reduce()</code> 時有提供 <code>initialValue</code>,則 <code>accumulator</code> 將會等於 <code>initialValue</code>,且 <code>currentValue</code> 會等於陣列中的第一個元素值;若沒有提供 <code>initialValue</code>,則 <code>accumulator</code> 會等於陣列的第一個元素值,且 <code>currentValue</code> 將會等於陣列的第二個元素值。</p> -<div class="note"> +<div class="notecard note"> <p><strong>備註:</strong>假如 <code>initialValue</code> 未被提供,<code>reduce()</code> 將會跳過第一個陣列索引,從陣列索引 1 開始執行回呼函式。若有提供 <code>initialValue</code>,則會由陣列索引 0 開始執行。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html index 7dd0fbdf34..4f6207b9a7 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html @@ -16,8 +16,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/some <div>{{EmbedInteractiveExample("pages/js/array-some.html")}}</div> -<div class="note"> -<p><strong>注意</strong>:如果輸入空陣列的話,這個方法會回傳 <code>false</code>。</p> +<div class="notecard note"> +<p><strong>備註:</strong>如果輸入空陣列的話,這個方法會回傳 <code>false</code>。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html index 6882aaf6ec..5c77343325 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html @@ -56,7 +56,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/ArrayBuffer <dd>Returns <code>true</code> if <code>arg</code> is one of the ArrayBuffer views, such as <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">typed array objects</a> or a {{jsxref("DataView")}}. Returns <code>false</code> otherwise.</dd> <dt>{{jsxref("ArrayBuffer.transfer", "ArrayBuffer.transfer(oldBuffer [, newByteLength])")}} {{experimental_inline}}</dt> <dd> - <div class="line">Returns a new <code>ArrayBuffer</code> whose contents are taken from the <code>oldBuffer</code>'s data and then is either truncated or zero-extended by <code>newByteLength</code>.</div> + <div>Returns a new <code>ArrayBuffer</code> whose contents are taken from the <code>oldBuffer</code>'s data and then is either truncated or zero-extended by <code>newByteLength</code>.</div> </dd> </dl> @@ -86,126 +86,11 @@ var view = new Int32Array(buffer);</pre> <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('Typed Array')}}</td> - <td>{{Spec2('Typed Array')}}</td> - <td>Superseded by ECMAScript 6.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-arraybuffer-constructor', 'ArrayBuffer')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition in an ECMA standard. Specified that <code>new</code> is required.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-arraybuffer-constructor', 'ArrayBuffer')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<p>{{CompatibilityTable}}</p> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Edge</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>7.0</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("2")}}</td> - <td>10</td> - <td>11.6</td> - <td>5.1</td> - </tr> - <tr> - <td><code>ArrayBuffer()</code> without <code>new</code> throws</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoDesktop("44")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td><code>ArrayBuffer.slice()</code> {{non-standard_inline}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}<br> - {{CompatNo}} {{CompatGeckoDesktop("53")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Edge</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>4.0</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("2")}}</td> - <td>10</td> - <td>11.6</td> - <td>4.2</td> - </tr> - <tr> - <td><code>ArrayBuffer()</code> without <code>new</code> throws</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile("44")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td><code>ArrayBuffer.slice()</code> {{non-standard_inline}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}<br> - {{CompatNo}} {{CompatGeckoMobile("53")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="相容性備註">相容性備註</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html b/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html index c25f3ee3a1..8890a3bc65 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/AsyncFunction <p>All arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed.</p> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> {{jsxref("Statements/async_function", "async functions")}} created with the <code>AsyncFunction</code> constructor do not create closures to their creation contexts; they are always created in the global scope. When running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the <code>AsyncFunction</code> constructor was called. This is different from using {{jsxref("Global_Objects/eval", "eval")}} with code for an async function expression.</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html index 35ccd60a0b..2e62e69184 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html @@ -19,8 +19,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt <dd>欲創建的數值,可以為整數或字串。</dd> </dl> -<div class="blockIndicator note"> -<p><strong>Note</strong>: <code>BigInt()</code> 不和 {{JSxRef("Operators/new", "new")}} 一起使用。</p> +<div class="notecard note"> +<p><strong>Note:</strong> <code>BigInt()</code> 不和 {{JSxRef("Operators/new", "new")}} 一起使用。</p> </div> <dl> @@ -47,8 +47,8 @@ const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111" <p><code>BigInt</code> 跟 {{JSxRef("Number")}} 很像,但在某些部分有些許不同 — 它不可以被用在內建的 {{JSxRef("Math")}} 物件方法中、而且不可以跟 <code>Number</code> 的實體混用運算子。</p> -<div class="blockIndicator warning"> -<p>{{JSxRef("Number")}} 和 <code>BigInt</code> 不能混和計算 — 他們必須被轉換到同一個型態。</p> +<div class="notecard warning"> +<p><strong>警告:</strong> {{JSxRef("Number")}} 和 <code>BigInt</code> 不能混和計算 — 他們必須被轉換到同一個型態。</p> <p>然而,在相互轉換時要注意, <code>BigInt</code> 在被轉換成 <code>Number</code> 時可能會遺失部分精度的資訊。</p> </div> @@ -97,8 +97,8 @@ bigN * -1n <p><code>/</code> 運算子也同樣的能夠運行。然而,因為型態是 <code>BigInt</code> 而不是 <code>BigDecimal</code> ,除法運算會無條件捨去小數。也就是說,回傳值不會包含小數部分。</p> -<div class="blockIndicator warning"> -<p>回傳值帶小數的運算在使用<code>BigInt</code> 時小數部分會被捨去。</p> +<div class="notecard warning"> +<p><strong>警告:</strong>回傳值帶小數的運算在使用<code>BigInt</code> 時小數部分會被捨去。</p> </div> <pre class="brush: js">const expected = 4n / 2n; @@ -251,26 +251,11 @@ nthPrime(20n) <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">規範</th> - <th scope="col">狀態</th> - </tr> - <tr> - <td><a href="https://tc39.github.io/proposal-bigint/#sec-bigint-objects">BigInt</a></td> - <td>Stage 3</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div> - - -<p>{{Compat("javascript.builtins.BigInt")}}</p> -</div> +{{Compat}} <h2 id="另見">另見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html b/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html index 0e817070dc..d35d07470b 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html @@ -104,91 +104,13 @@ var bObjProto = new Boolean({}); <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.0.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.6', 'Boolean')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-boolean-objects', 'Boolean')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-boolean-objects', 'Boolean')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> <div>{{CompatibilityTable}}</div> -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Edge</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatIE("6.0")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Edge</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html b/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html index 8d4406dd9e..f7ef3094ff 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html @@ -80,82 +80,11 @@ dv.getInt16(1); //42 <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('Typed Array')}}</td> - <td>{{Spec2('Typed Array')}}</td> - <td>Superseded by ECMAScript 6</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-dataview-constructor', 'DataView')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition in an ECMA standard</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-dataview-constructor', 'DataView')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<p>{{CompatibilityTable}}</p> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>9.0</td> - <td>{{CompatGeckoDesktop("15.0")}}</td> - <td>10</td> - <td>12.1</td> - <td>5.1</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>4.0</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("15")}}</td> - <td>{{CompatUnknown}}</td> - <td>12.0</td> - <td>4.2</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="Firefox-specific_notes">Firefox-specific notes</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html index dd5ebc36d4..80ab81fa2d 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html @@ -29,8 +29,8 @@ var weekday = Xmas95.getDay(); console.log(weekday); // 1 </pre> -<div class="blockIndicator note"> -<p><strong>Note:</strong> 如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}加上<code>options</code>參數來獲取星期幾全名。使使用此方法能輕鬆做出各種國際語言:</p> +<div class="notecard note"> +<p><strong>備註:</strong>如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}加上<code>options</code>參數來獲取星期幾全名。使使用此方法能輕鬆做出各種國際語言:</p> <pre class="brush: js">var options = { weekday: 'long'}; console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95)); diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/index.html index 1b1873dd22..9e7cab6fe9 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/date/index.html @@ -18,18 +18,18 @@ new Date(<var>dateString</var>); new Date(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <var>minutes</var>[, <var>seconds</var>[, <var>milliseconds</var>]]]]]); </pre> -<div class="note"> -<p><strong>附註:</strong> JavaScript <code>Date</code> 物件只能由以 Date 作為建構子來產生,如果把 Date 作為一般的函數來呼叫(省略掉 {{jsxref("Operators/new", "new")}} 運算子)將會得到一個字串而非 Date 物件;與其它 JavaScript 物件不同,它並沒有物件實體語法(例如:以中刮號 [ ] 表示陣列的宣告方式)。</p> +<div class="notecard note"> +<p><strong>備註:</strong>JavaScript <code>Date</code> 物件只能由以 Date 作為建構子來產生,如果把 Date 作為一般的函數來呼叫(省略掉 {{jsxref("Operators/new", "new")}} 運算子)將會得到一個字串而非 Date 物件;與其它 JavaScript 物件不同,它並沒有物件實體語法(例如:以中刮號 [ ] 表示陣列的宣告方式)。</p> </div> <h3 id="參數">參數</h3> -<div class="note"> -<p><strong>附註:</strong>當傳入超過一個參數到 Date 建構子,若參數值超過它的合理範圍(例如:傳數值 13 到月份,或傳數值 70 給分鐘),相鄰的參數值將會被調整。例如: <code>new Date(2013, 13, 1)</code> 將等同於 <code>new Date(2014, 1, 1)</code> 都會建立代表 <code>2014-02-01</code> 的物件(注意月份值由 0 開始)。同樣的, <code>new Date(2013, 2, 1, 0, 70)</code> 與 <code>new Date(2013, 2, 1, 1, 10)</code> 一樣會建立代表 <code>2013-03-01T01:10:00</code> 的 Date 物件。</p> +<div class="notecard note"> +<p><strong>備註:</strong>當傳入超過一個參數到 Date 建構子,若參數值超過它的合理範圍(例如:傳數值 13 到月份,或傳數值 70 給分鐘),相鄰的參數值將會被調整。例如: <code>new Date(2013, 13, 1)</code> 將等同於 <code>new Date(2014, 1, 1)</code> 都會建立代表 <code>2014-02-01</code> 的物件(注意月份值由 0 開始)。同樣的, <code>new Date(2013, 2, 1, 0, 70)</code> 與 <code>new Date(2013, 2, 1, 1, 10)</code> 一樣會建立代表 <code>2013-03-01T01:10:00</code> 的 Date 物件。</p> </div> -<div class="note"> -<p><strong>附註:</strong>當傳入超過一個參數到 Date 建構子,所指定的參數值會視為本地時間。如果希望指定的值為世界標準時間(UTC),則應使用 <code>new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}})</code> 語法,傳入一樣格式的參數。</p> +<div class="notecard note"> +<p><strong>備註:</strong>當傳入超過一個參數到 Date 建構子,所指定的參數值會視為本地時間。如果希望指定的值為世界標準時間(UTC),則應使用 <code>new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}})</code> 語法,傳入一樣格式的參數。</p> </div> <dl> @@ -37,8 +37,8 @@ new Date(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <dd>自世界標準時間(UTC) 1970 年 1 月 1 日 00:00:00 開始的毫秒整數(Integer)值(Unix 紀元;但要注意到大多 Unix 時間戳記是以秒而非毫秒為單位)。</dd> <dt><code>dateString</code></dt> <dd>表示時間日期的字串。這個字串應該要能被 {{jsxref("Date.parse()")}} 方法解析(符合 <a href="http://tools.ietf.org/html/rfc2822#page-14">IETF-compliant RFC 2822 timestamps</a> 及 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a> 格式要求). - <div class="note"> - <p><strong>附註:</strong> 由於各家瀏覽器有所不同且具有差異性,因此非常不鼓勵使用 Date 建構子(或 <code>Date.parse</code> 方法,它們是同等的)來解析時間日期字串。</p> + <div class="notecard note"> + <p><strong>備註:</strong>由於各家瀏覽器有所不同且具有差異性,因此非常不鼓勵使用 Date 建構子(或 <code>Date.parse</code> 方法,它們是同等的)來解析時間日期字串。</p> </div> </dd> <dt><code>year</code></dt> @@ -84,8 +84,8 @@ new Date(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <dd>回傳對應於當下時間的數值 - 1970/01/01 00:00:00 (UTC) 到當下的毫秒數。</dd> <dt>{{jsxref("Date.parse()")}}</dt> <dd>解析字串所表示的時間,回傳由 1970/01/01 00:00:00 (UTC) 到該時間的毫秒數值。 - <div class="note"> - <p><strong>附註:</strong>由於瀏覽器之間的不同與差異,強烈不建議使用 <code>Date.parse</code> 。</p> + <div class="notecard note"> + <p><strong>備註:</strong>由於瀏覽器之間的不同與差異,強烈不建議使用 <code>Date.parse</code> 。</p> </div> </dd> <dt>{{jsxref("Date.UTC()")}}</dt> @@ -106,8 +106,8 @@ new Date(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <p>接下來的幾個範例,展示幾種建立 Date 物件的方式:</p> -<div class="note"> -<p><strong>附註:</strong> 由於瀏覽器之間的不同與差異,強烈不建議使用解析字串的方式建立 Date 物件。</p> +<div class="notecard note"> +<p><strong>備註:</strong>由於瀏覽器之間的不同與差異,強烈不建議使用解析字串的方式建立 Date 物件。</p> </div> <pre class="brush: js">var today = new Date(); @@ -166,97 +166,17 @@ function printElapsedTime(fTest) { yourFunctionReturn = printElapsedTime(yourFunction); </pre> -<div class="note"> -<p><strong>附註:</strong>在瀏覽器支援 {{domxref("window.performance", "Web Performance API", "", 1)}} 高精度特性下, {{domxref("Performance.now()")}} 可以提供比 {{jsxref("Date.now()")}} 更可靠、精確的執行時間測試結果。</p> +<div class="notecard note"> +<p><strong>備註:</strong>在瀏覽器支援 {{domxref("window.performance", "Web Performance API", "", 1)}} 高精度特性下, {{domxref("Performance.now()")}} 可以提供比 {{jsxref("Date.now()")}} 更可靠、精確的執行時間測試結果。</p> </div> <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('ESDraft', '#sec-date-objects', 'Date')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-date-objects', 'Date')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.9', 'Date')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>初步定義。實作在 JavaScript 1.1。</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td> - <p>基本支援</p> - </td> - <td>{{CompatVersionUnknown}} [1]</td> - <td>{{CompatVersionUnknown}} [1]</td> - <td>{{CompatVersionUnknown}} [2]</td> - <td>{{CompatVersionUnknown}} [1]</td> - <td>{{CompatVersionUnknown}} [1]</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td> - <p>基本支援</p> - </td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <p>[1] 一些瀏覽器在解析日期時間會發生問題: <a href="http://dygraphs.com/date-formats.html">3/14/2012 blog from danvk Comparing FF/IE/Chrome on Parsing Date Strings</a></p> diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html index ca67a2e534..a6ea13ec86 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html @@ -38,82 +38,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/now <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('ES5.1', '#sec-15.9.4.4', 'Date.now')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>初始定義,實作在 JavaScript 1.5 。</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-date.now', 'Date.now')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-date.now', 'Date.now')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatChrome("5")}}</td> - <td>{{CompatGeckoDesktop("1.9")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("10.50")}}</td> - <td>{{CompatSafari("4")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="相關資源">相關資源</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html index 50ab7590ea..9d9a95d526 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html @@ -67,88 +67,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/UTC <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('ESDraft', '#sec-date.utc', 'Date.UTC')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-date.utc', 'Date.UTC')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.9.4.3', 'Date.UTC')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>初始定義。<br> - 實作在 JavaScript 1.0.</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>平台</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="相關資源">相關資源</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html b/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html index ca1dc77233..55e052ed77 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html @@ -22,55 +22,7 @@ console.log(e.columnNumber) // 0 <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="See_also">See also</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/error/index.html b/files/zh-tw/web/javascript/reference/global_objects/error/index.html index 51e58faf45..67f675c25a 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/error/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/error/index.html @@ -111,8 +111,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Error <p>You might want to define your own error types deriving from <code>Error</code> to be able to <code>throw new MyError()</code> and use <code>instanceof MyError</code> to check the kind of error in the exception handler. The common way to do this is demonstrated below.</p> -<div class="warning"> -<p>Note that the thrown <code>MyError</code> will report incorrect <code>lineNumber</code> and <code>fileName</code> at least in Firefox.</p> +<div class="notecard warning"> +<p><strong>Warning:</strong> Note that the thrown <code>MyError</code> will report incorrect <code>lineNumber</code> and <code>fileName</code> at least in Firefox.</p> </div> <p>See also the <a href="http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript">"What's a good way to extend Error in JavaScript?" discussion on Stackoverflow</a>.</p> @@ -142,87 +142,11 @@ try { <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</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.11', 'Error')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-error-objects', 'Error')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-error-objects', 'Error')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html index 9d5aba8312..03e58de21b 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html @@ -7,8 +7,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply <p><code><strong>apply() </strong>方法會呼叫一個以 this 的代表值和一個陣列形式的值組(或是一個 </code><a href="/en-US/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects">array-like object</a> <code>)為參數的函式。</code></p> -<div class="note"> -<p><strong>注意:</strong>這個函式的語法和{{jsxref("Function.call", "call()")}} 幾乎一樣,最大的不同是 <code>call()</code> 接受<code><strong>一連串的參數</strong></code>,而 <code>apply() 接受<strong>一組陣列形式的參數</strong>。</code></p> +<div class="notecard note"> +<p><strong>備註:</strong>這個函式的語法和{{jsxref("Function.call", "call()")}} 幾乎一樣,最大的不同是 <code>call()</code> 接受<code><strong>一連串的參數</strong></code>,而 <code>apply() 接受<strong>一組陣列形式的參數</strong>。</code></p> </div> <h2 id="語法">語法</h2> @@ -38,8 +38,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply <p>從 ECMAScript 5th 版本後,也可以使用陣列形式的物件,在實踐上這代表他會擁有 <code>length 以及整數範圍 </code> <code>(0...length-1) 的屬性。舉例來說,你可以使用 </code>{{domxref("NodeList")}} 或是一個像這樣的自定義屬性: <code>{ 'length': 2, '0': 'eat', '1': 'bananas' }。</code></p> -<div class="note"> -<p>一般瀏覽器,包括 Chrome 14 及 Internet Explorer 9,仍不支援陣列形式的物件,所以會對此丟出一個錯誤。</p> +<div class="notecard note"> +<p><strong>備註:</strong>一般瀏覽器,包括 Chrome 14 及 Internet Explorer 9,仍不支援陣列形式的物件,所以會對此丟出一個錯誤。</p> </div> <h2 id="範例">範例</h2> @@ -55,8 +55,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply }; </pre> -<div class="note"> -<p><strong>注意:</strong>如上範例的 <code>Object.create()</code> 方法是屬於比較新的寫法。如需使用閉包的替代方法,請參考以下的範例:</p> +<div class="notecard note"> +<p><strong>備註:</strong>如上範例的 <code>Object.create()</code> 方法是屬於比較新的寫法。如需使用閉包的替代方法,請參考以下的範例:</p> <pre class="brush: js">Function.prototype.construct = function(aArgs) { var fConstructor = this, fNewConstr = function() { @@ -83,8 +83,8 @@ console.log(myInstance instanceof MyConstructor); // logs 'true' console.log(myInstance.constructor); // logs 'MyConstructor' </pre> -<div class="note"> -<p><strong>注意:</strong>This non-native <code>Function.construct</code> method will not work with some native constructors (like {{jsxref("Date")}}, for example). In these cases you have to use the {{jsxref("Function.prototype.bind")}} method (for example, imagine having an array like the following, to be used with {{jsxref("Global_Objects/Date", "Date")}} constructor: <code>[2012, 11, 4]</code>; in this case you have to write something like: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> — anyhow this is not the best way to do things and probably should not be used in any production environment).</p> +<div class="notecard note"> +<p><strong>備註:</strong>This non-native <code>Function.construct</code> method will not work with some native constructors (like {{jsxref("Date")}}, for example). In these cases you have to use the {{jsxref("Function.prototype.bind")}} method (for example, imagine having an array like the following, to be used with {{jsxref("Global_Objects/Date", "Date")}} constructor: <code>[2012, 11, 4]</code>; in this case you have to write something like: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> — anyhow this is not the best way to do things and probably should not be used in any production environment).</p> </div> <h3 id="使用_apply_於內建的函數">使用 <code>apply</code> 於內建的函數</h3> @@ -150,104 +150,11 @@ someobject.foo = function() { <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Initial definition. Implemented in JavaScript 1.3.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.3.4.3', 'Function.prototype.apply')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function.prototype.apply', 'Function.prototype.apply')}}</td> - <td>{{Spec2('ES6')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function.prototype.apply', 'Function.prototype.apply')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - <tr> - <td>ES 5.1 generic array-like object as {{jsxref("Functions/arguments", "arguments")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("2.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - <tr> - <td>ES 5.1 generic array-like object as {{jsxref("Functions/arguments", "arguments")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile("2.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html index 006db2aa4c..12ce075840 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html @@ -108,7 +108,7 @@ flower.bloom(); <h3 id="Bound_functions_used_as_constructors">Bound functions used as constructors</h3> -<div class="warning"> +<div class="notecard warning"> <p><strong>Warning:</strong> This section demonstrates JavaScript capabilities and documents some edge cases of the <code>bind()</code> method. The methods shown below are not the best way to do things and probably should not be used in any production environment.</p> </div> @@ -231,86 +231,11 @@ slice(arguments); <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.3.4.5', 'Function.prototype.bind')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.8.5.</td> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-function.prototype.bind', 'Function.prototype.bind')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function.prototype.bind', 'Function.prototype.bind')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Edge</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("7")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("2")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("11.60")}}</td> - <td>{{CompatSafari("5.1")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Edge</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatAndroid("4.0")}}</td> - <td>{{CompatChrome("1")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("2")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatOperaMobile("11.5")}}</td> - <td>{{CompatSafari("6.0")}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="相關連結">相關連結</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html index 1d1d2017ee..64a42d065a 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html @@ -9,12 +9,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/call <p>使用給定的<code>this</code>參數以及分別給定的參數來呼叫某個函數</p> -<div class="note"><strong>附註:</strong> 此函數的所有語法大致上與<code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply">apply()</a></code>相同,他們基本上不同處只有 <code>call()</code> 接受一連串的參數,而 <code>apply()</code> 單一的array作為參數</div> +<div class="notecard note"> + <p><strong>備註:</strong> 此函數的所有語法大致上與<code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply">apply()</a></code>相同,他們基本上不同處只有 <code>call()</code> 接受一連串的參數,而 <code>apply()</code> 單一的array作為參數</p> +</div> <table class="standard-table"> <thead> <tr> - <th class="header" colspan="2"><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function">Function </a>物件的方法</th> + <th colspan="2"><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function">Function </a>物件的方法</th> </tr> </thead> <tbody> @@ -98,6 +100,14 @@ for (var i = 0; i < animals.length; i++) { } </pre> +<h2 id="規範">規範</h2> + +{{Specifications}} + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +{{Compat}} + <h2 id="參見">參見</h2> <ul> diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/index.html index c7321e3bd8..72c75d7615 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/function/index.html @@ -96,87 +96,11 @@ console.log(f2()); // 20 <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.0.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.3', 'Function')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function-objects', 'Function')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function-objects', 'Function')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html index f1498d4e5d..6e83cb3b2c 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html @@ -38,104 +38,11 @@ console.log((function(a, b = 1, c) {}).length); /* 1 */ <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>最初的定義,在 JavaScript 1.1 中實作。</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.3.5.1', 'Function.length')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function-instances-length', 'Function.length')}}</td> - <td>{{Spec2('ES6')}}</td> - <td><code>此 </code>property 的 <code>configurable</code> attribute 現在為 <code>true</code>.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function-instances-length', 'Function.length')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>特點</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - <tr> - <td>Configurable: true</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoDesktop(37)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - <tr> - <td>Configurable: true</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile(37)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="可參閱">可參閱</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html index 663d5fb6ce..c5623e7a89 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html @@ -77,82 +77,11 @@ JSON.parse('{"foo" : 1, }'); <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('ES5.1', '#sec-15.12.2', 'JSON.parse')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>初始定義。從 JavaScript 1.7 導入。</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-json.parse', 'JSON.parse')}}</td> - <td>{{Spec2('ES6')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-json.parse', 'JSON.parse')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>特徵</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>基本功能</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("1.9.1")}}</td> - <td>{{CompatIE("8.0")}}</td> - <td>{{CompatOpera("10.5")}}</td> - <td>{{CompatSafari("4.0")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>特徵</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>基本功能</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("1.0")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="Gecko相關">Gecko相關</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html index 98f01ef784..bc254ca8b5 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html @@ -76,7 +76,7 @@ JSON.stringify( Object.create(null, { x: { value: 'x', enumerable: false }, y: { </pre> -<h3 id="The_replacer_parameter"><a></a>The <code>replacer</code> parameter</h3> +<h3 id="The_replacer_parameter">The <code>replacer</code> parameter</h3> <p>The <code>replacer</code> parameter can be either a function or an array. As a function, it takes two parameters, the key and the value being stringified. The object in which the key was found is provided as the replacer's <code>this</code> parameter. Initially it gets called with an empty key representing the object being stringified, and it then gets called for each property on the object or array being stringified. It should return the value that should be added to the JSON string, as follows:</p> @@ -88,7 +88,7 @@ JSON.stringify( Object.create(null, { x: { value: 'x', enumerable: false }, y: { <li>If you return <code>undefined</code>, the property is not included (i.e., filtered out) in the output JSON string.</li> </ul> -<div class="note"><strong>Note:</strong> You cannot use the <code>replacer</code> function to remove values from an array. If you return <code>undefined</code> or a function then <code>null</code> is used instead.</div> +<div class="notecard note"><p><strong>Note:</strong> You cannot use the <code>replacer</code> function to remove values from an array. If you return <code>undefined</code> or a function then <code>null</code> is used instead.</p></div> <h4 id="Example_with_a_function">Example with a function</h4> @@ -113,7 +113,7 @@ JSON.stringify(foo, replacer); // '{"week":45,"month":7}', only keep "week" and "month" properties </pre> -<h3 id="The_space_argument"><a></a>The <code>space</code> argument</h3> +<h3 id="The_space_argument">The <code>space</code> argument</h3> <p>The <code>space</code> argument may be used to control spacing in the final string. If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will be indented by this string (or the first ten characters of it).</p> @@ -209,8 +209,8 @@ alert(jsFriendlyJSONStringify(s)); // {"a":"\u2028","b":"\u2029"}</pre> <p>In a case where you want to store an object created by your user and allowing it to be restored even after the browser has been closed, the following example is a model for the applicability of <code>JSON.stringify()</code>:</p> -<div class="warning"> -<p>Functions are not a valid JSON data type so they will not work. However, they can be displayed if first converted to a string (e.g. in the replacer), via the function's toString method. Also, some objects like {{jsxref("Date")}} will be a string after {{jsxref("JSON.parse()")}}.</p> +<div class="notecard warning"> +<p><strong>Warning:</strong> Functions are not a valid JSON data type so they will not work. However, they can be displayed if first converted to a string (e.g. in the replacer), via the function's toString method. Also, some objects like {{jsxref("Date")}} will be a string after {{jsxref("JSON.parse()")}}.</p> </div> <pre class="brush: js">// Creating an example of JSON @@ -238,40 +238,13 @@ var restoredSession = JSON.parse(localStorage.getItem('session')); console.log(restoredSession); </pre> -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.12.3', 'JSON.stringify')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.7.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-json.stringify', 'JSON.stringify')}}</td> - <td>{{Spec2('ES6')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-json.stringify', 'JSON.stringify')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<div> - - -<p>{{Compat("javascript.builtins.JSON.stringify")}}</p> -</div> +<h2 id="規範">規範</h2> + +{{Specifications}} + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +{{Compat}} <h2 id="See_also">See also</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/index.html index 2b09b4de23..b200a53959 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/math/index.html @@ -40,12 +40,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math <h2 id="方法">方法</h2> -<div class="note"> -<p>注意三角函數 (<code>sin()</code>, <code>cos()</code>, <code>tan()</code>, <code>asin()</code>, <code>acos()</code>, <code>atan()</code>, <code>atan2()</code>) 的參數或回傳值的角度皆以弧度為單位。把角度乘上 <code>(Math.PI / 180)</code> 會得到弧度單位,將弧度除以該數則會轉換回一般所用的角度單位。</p> +<div class="notecard note"> +<p><strong>備註:</strong>三角函數 (<code>sin()</code>, <code>cos()</code>, <code>tan()</code>, <code>asin()</code>, <code>acos()</code>, <code>atan()</code>, <code>atan2()</code>) 的參數或回傳值的角度皆以弧度為單位。把角度乘上 <code>(Math.PI / 180)</code> 會得到弧度單位,將弧度除以該數則會轉換回一般所用的角度單位。</p> </div> -<div class="note"> -<p>注意許多數學方法的精度是取決於實作方式的。這意味著不同的瀏覽器可能會得到不同的結果,甚至同一個 JS引擎在不同的作業系統或架構上所得到的結果都有可能相異。</p> +<div class="notecard note"> +<p><strong>備註:</strong>許多數學方法的精度是取決於實作方式的。這意味著不同的瀏覽器可能會得到不同的結果,甚至同一個 JS引擎在不同的作業系統或架構上所得到的結果都有可能相異。</p> </div> <dl> diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html index 6731d1c2b4..8087d30bfd 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html @@ -10,8 +10,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random <p>函數 <strong><code>Math.random()</code></strong> 會回傳一個偽隨機小數 (pseudo-random) 介於0到1之間(包含 0,不包含1) ,大致符合數學與統計上的均勻分佈 (uniform distribution) ,您可以選定想要的數字區間,它會透過演算法被產生並且不允許使用者自行跳選或重設成特定數字。{{EmbedInteractiveExample("pages/js/math-random.html")}}</p> -<div class="note"> -<p><code>Math.random()</code> 所產生的偽隨機小數不符合加密學安全性要求。<em>請勿使用於任何加密、資安相關領域。</em></p> +<div class="notecard note"> +<p><strong>備註:</strong><code>Math.random()</code> 所產生的偽隨機小數不符合加密學安全性要求。<em>請勿使用於任何加密、資安相關領域。</em></p> <p><em>如有加密需求建議參考Web Crypto API</em><a href="/en-US/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></p> </div> @@ -55,8 +55,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random } </pre> -<div class="note"> -<p>It might be tempting to use <code>Math.round()</code> to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.</p> +<div class="notecard note"> +<p><strong>Note:</strong> might be tempting to use <code>Math.round()</code> to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.</p> </div> <h3 id="Getting_a_random_integer_between_two_values_inclusive">Getting a random integer between two values, inclusive</h3> @@ -69,24 +69,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random return Math.floor(Math.random() * (max - min + 1) + min); //The maximum is inclusive and the minimum is inclusive }</pre> -<h2 id="Specifications">Specifications</h2> +<h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-math.random', 'Math.random')}}</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<p>{{Compat("javascript.builtins.Math.random")}}</p> +{{Compat}} -<h2 class="countTop" id="其他參考資料">其他參考資料</h2> +<h2 id="其他參考資料">其他參考資料</h2> <ul> <li><a href="/en-US/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></li> diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html index efde660a66..8b37f8b851 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html @@ -126,80 +126,11 @@ Math.ceil10(-59, 1); // -50 <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.0.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.8.2.15', 'Math.round')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-math.round', 'Math.round')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari (WebKit)</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Phone</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/null/index.html b/files/zh-tw/web/javascript/reference/global_objects/null/index.html index a32debbd16..2e270445a6 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/null/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/null/index.html @@ -34,87 +34,11 @@ null == undefined // true <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-4.3.11', 'null value')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-null-value', 'null value')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-null-value', 'null value')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<p>{{CompatibilityTable}}</p> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/index.html index cda3475d0b..45500f4178 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/number/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/number/index.html @@ -67,8 +67,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number <dd>判斷傳入的值是不是一個整數。</dd> <dt>{{jsxref("Number.isSafeInteger()")}}</dt> <dd>判斷傳入的值是不是在 IEEE-754 雙精度範圍間 (即介於 <code>-(2^53 - 1)</code> 和 <code>2^53 - 1</code>之前)。</dd> - <dt><s class="obsoleteElement">{{jsxref("Number.toInteger()")}} {{obsolete_inline}}</s></dt> - <dd><s class="obsoleteElement">被用來評估傳入的值且將其轉換成整數 (或 {{jsxref("Global_Objects/Infinity", "Infinity")}}) 但已被移除。</s></dd> <dt>{{jsxref("Number.parseFloat()")}}</dt> <dd>這個方法和全域物件的 {{jsxref("parseFloat", "parseFloat()")}} 相同。</dd> <dt>{{jsxref("Number.parseInt()")}}</dt> @@ -129,87 +127,11 @@ Number("100a") // NaN <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', 'Number')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-number-objects', 'Number')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>New methods and properties added: {{jsxref("Number.EPSILON", "EPSILON")}}, {{jsxref("Number.isFinite", "isFinite")}}, {{jsxref("Number.isInteger", "isInteger")}}, {{jsxref("Number.isNaN", "isNaN")}}, {{jsxref("Number.parseFloat", "parseFloat")}}, {{jsxref("Number.parseInt", "parseInt")}}</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-number-objects', 'Number')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="瀏覽器相容">瀏覽器相容</h2> - -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Specifications}} + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html index 9c40c2fe5b..884ed6d97c 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html @@ -71,89 +71,13 @@ console.log(77.1234.toExponential()); // logs 7.71234e+1 console.log(77 .toExponential()); // logs 7.7e+1 </pre> -<h2 id="Specifications">Specifications</h2> +<h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Initial definition. Implemented in JavaScript 1.5.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.7.4.6', 'Number.prototype.toExponential')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="瀏覽器支援度">瀏覽器支援度</h2> +{{Specifications}} -<div>{{CompatibilityTable}}</div> +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="延伸閱讀">延伸閱讀</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html index f8e71aeae1..b58f9173cd 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html @@ -171,82 +171,11 @@ o2 = Object.create({}, { <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.3.5', 'Object.create')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.8.5.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object.create', 'Object.create')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object.create', 'Object.create')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("5")}}</td> - <td>{{CompatGeckoDesktop("2")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("11.60")}}</td> - <td>{{CompatSafari("5")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("2")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatOperaMobile("11.5")}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參閱">參閱</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html index 7739ab4bdd..1ea2f29f71 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html @@ -69,7 +69,7 @@ Object.defineProperties(obj, { <p>Assuming a pristine execution environment with all names and properties referring to their initial values, <code>Object.defineProperties</code> is almost completely equivalent (note the comment in <code>isCallable</code>) to the following reimplementation in JavaScript:</p> -<pre class="brush: js;highlight:[8]">function defineProperties(obj, properties) { +<pre class="brush: js">function defineProperties(obj, properties) { function convertToDescriptor(desc) { function hasProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); @@ -131,82 +131,13 @@ Object.defineProperties(obj, { } </pre> -<h2 id="規格">規格</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">註記</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.3.7', 'Object.defineProperties')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.8.5</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object.defineproperties', 'Object.defineProperties')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object.defineproperties', 'Object.defineProperties')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +<h2 id="規範">規範</h2> + +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Firefox (Gecko)</th> - <th>Chrome</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatGeckoDesktop("2")}}</td> - <td>{{CompatChrome("5")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("11.60")}}</td> - <td>{{CompatSafari("5")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Firefox Mobile (Gecko)</th> - <th>Android</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatGeckoMobile("2")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatOperaMobile("11.5")}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參閱">參閱</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html index f9f6c44d39..7413ff384c 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html @@ -7,8 +7,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperty <p>靜態方法 <code><strong>Object.defineProperty()</strong></code> 會直接對一個物件定義、或是修改現有的屬性。執行後會回傳定義完的物件。</p> -<div class="note"> -<p><strong>注:</strong>這個方法會直接針對 {{jsxref("Object")}} 呼叫建構子(constructor),而不是 <code>Object</code> 型別的實例。</p> +<div class="notecard note"> +<p><strong>備註:</strong>這個方法會直接針對 {{jsxref("Object")}} 呼叫建構子(constructor),而不是 <code>Object</code> 型別的實例。</p> </div> <div>{{EmbedInteractiveExample("pages/js/object-defineproperty.html")}}</div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html index b063094f52..8f0ff15f9f 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html @@ -41,77 +41,11 @@ Object.getPrototypeOf("foo"); <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.3.2', 'Object.getPrototypeOf')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object.getprototypeof', 'Object.getProtoypeOf')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("5")}}</td> - <td>{{CompatGeckoDesktop("1.9.1")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("12.10")}}</td> - <td>{{CompatSafari("5")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="Opera_註">Opera 註</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html index 58fe485c22..41bd582c4e 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html @@ -96,82 +96,11 @@ Object.prototype.hasOwnProperty.call(foo, 'bar'); // true <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('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Initial definition. Implemented in JavaScript 1.5.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.4.5', 'Object.prototype.hasOwnProperty')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object.prototype.hasownproperty', 'Object.prototype.hasOwnProperty')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/index.html index 40468bd608..89e99e6359 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/index.html @@ -133,87 +133,11 @@ var o = new Object(Boolean()); <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.0.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2', 'Object')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td></td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object-objects', 'Object')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Added Object.assign, Object.getOwnPropertySymbols, Object.setPrototypeOf, Object.is</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object-objects', 'Object')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td>Added Object.entries, Object.values and Object.getOwnPropertyDescriptors.</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html index 5bf8e8a559..3be978f7f8 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html @@ -119,82 +119,11 @@ if (!Object.keys) { <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.3.14', 'Object.keys')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.8.5.</td> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-object.keys', 'Object.keys')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object.keys', 'Object.keys')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("5")}}</td> - <td>{{CompatGeckoDesktop("2.0")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("12")}}</td> - <td>{{CompatSafari("5")}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html index da1dc83526..2a06e61d0c 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html @@ -73,99 +73,11 @@ Object.preventExtensions(1); <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.2.3.10', 'Object.preventExtensions')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.8.5.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-object.preventextensions', 'Object.preventExtensions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object.preventextensions', 'Object.preventExtensions')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="瀏覽器相容度">瀏覽器相容度</h2> - -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("6")}}</td> - <td>{{CompatGeckoDesktop("2.0")}}</td> - <td>{{CompatIE("9")}}</td> - <td>{{CompatOpera("12")}}</td> - <td>{{CompatSafari("5.1")}}</td> - </tr> - <tr> - <td>ES6 behavior for non-object argument</td> - <td>{{CompatChrome("44")}}</td> - <td>{{CompatGeckoDesktop("35.0")}}</td> - <td>{{CompatIE("11")}}</td> - <td>{{CompatOpera("31")}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>ES6 behavior for non-object argument</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile("35.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> +{{Specifications}} + +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> + +{{Compat}} <h2 id="閱讀更多">閱讀更多</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html index 5ba5c8f615..ebb05d1e1d 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html @@ -3,11 +3,11 @@ title: Object.prototype.__proto__ slug: Web/JavaScript/Reference/Global_Objects/Object/proto translation_of: Web/JavaScript/Reference/Global_Objects/Object/proto --- -<div class="warning"> +<div class="notecard warning"> <p><strong>Warning:</strong> 基於現代Javascript引擎最佳化物件屬性存取的方法,改變一個物件的 <code>[[Prototype]]</code> 在任何瀏覽器或是Javascript引擎都是非常慢的操作?。改變繼承屬性對效能的影響微妙且深遠,不僅僅只是影響執行 <code>obj.__proto__ = ...</code> 的時間,而是會影響到所有有存取到被改變 <code>[[Prototype]]</code> 的物件的程式碼的執行時間。如果你在乎效能的話就應該避免改變一個物件的 <code>[[Prototype]]</code> 。反之,請用 {{jsxref("Object.create()")}} 來產生一個擁有 <code>[[Prototype]]</code> 的物件。</p> </div> -<div class="warning"> +<div class="notecard warning"> <p><strong>Warning:</strong> 雖然 <code>Object.prototype.__proto__</code> 在今日已經被絕大部分的瀏覽器所支援,其存在與確切的行為只有在 ECMAScript 2015 規範才被標準化成一個歷史功能來確保相容性。為了更好的支援,建議使用{{jsxref("Object.getPrototypeOf()")}}。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html index d1d76d3d80..c4cf9ff4dc 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html @@ -45,8 +45,8 @@ p.finally(function() { </li> </ul> -<div class="note"> -<p><strong>備註: </strong>在 finally 回呼中使用 throw (或回傳 rejected promise)會導致新的 promise 被 reject , reject 的原因則是呼叫 throw() 時所指定的值。</p> +<div class="notecard note"> +<p><strong>備註:</strong>在 finally 回呼中使用 throw (或回傳 rejected promise)會導致新的 promise 被 reject , reject 的原因則是呼叫 throw() 時所指定的值。</p> </div> <h2 id="Examples">Examples</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/index.html index ec38359021..a434a6d4dd 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/index.html @@ -7,8 +7,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise <p><strong><code>Promise</code></strong> 物件代表一個即將完成、或失敗的非同步操作,以及它所產生的值。</p> -<div class="note"> -<p>此條目為介紹 Promise 建構式。要瞭解 Promise 相關使用方式,請先參考<a href="/zh-TW/docs/Web/JavaScript/Guide/Using_promises">使用 Promise</a>。Promise 建構式主要用於包裹尚未支援 Promise 的函式。</p> +<div class="notecard note"> +<p><strong>備註:</strong>此條目為介紹 Promise 建構式。要瞭解 Promise 相關使用方式,請先參考<a href="/zh-TW/docs/Web/JavaScript/Guide/Using_promises">使用 Promise</a>。Promise 建構式主要用於包裹尚未支援 Promise 的函式。</p> </div> <div>{{EmbedInteractiveExample("pages/js/promise-constructor.html")}}</div> @@ -42,12 +42,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise <p><img alt="" src="https://cdn.rawgit.com/Vectaio/a76330b025baf9bcdf07cb46e5a9ef9e/raw/26c4213a93dee1c39611dcd0ec12625811b20a26/js-promise.svg"></p> -<div class="note"> -<p><strong>容易混淆:</strong> 許多其他語言擁有機制用來惰性求值(lazy evaluation)及延遲(deferring)運算,它們也被稱作“promises” — e.g. Scheme. 然而在 JavaScript 中 Promises 代表那些(已經)發生中(happening)的程序,它們可以繫結回呼函式。若您要找的是惰性求值表示式,考慮不帶參數的 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function</a>:<code>f = () => <em>expression</em></code> 來建立惰性求值表示式,並透過 <code>f()</code> 進行求值.</p> +<div class="notecard note"> +<p><strong>備註:</strong> 許多其他語言擁有機制用來惰性求值(lazy evaluation)及延遲(deferring)運算,它們也被稱作“promises” — e.g. Scheme. 然而在 JavaScript 中 Promises 代表那些(已經)發生中(happening)的程序,它們可以繫結回呼函式。若您要找的是惰性求值表示式,考慮不帶參數的 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function</a>:<code>f = () => <em>expression</em></code> 來建立惰性求值表示式,並透過 <code>f()</code> 進行求值.</p> </div> -<div class="note"> -<p><strong>Note</strong>: 一個被實現或拒絕,但不處於 pending 的 promise 被稱作被解決(settled)。您也會見到使用解決(resolved)一詞來描述 promises — 這代表 promises 被實現(fulfilled)了。<a href="https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md">States and fates</a> 這篇文章包含了更多 promises 的專有名詞。</p> +<div class="notecard note"> +<p><strong>備註:</strong>一個被實現或拒絕,但不處於 pending 的 promise 被稱作被解決(settled)。您也會見到使用解決(resolved)一詞來描述 promises — 這代表 promises 被實現(fulfilled)了。<a href="https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md">States and fates</a> 這篇文章包含了更多 promises 的專有名詞。</p> </div> <h2 id="屬性">屬性</h2> @@ -181,7 +181,7 @@ function testPromise() { ') Promise made (<small>Sync code terminated</small>)<br/>'); }</pre> -<p><sub>*譯註:resolver function 即 executor function。</sub></p> +<p>*譯註:resolver function 即 executor function。</p> <pre class="brush:js">if ("Promise" in window) { let btn = document.getElementById("btn"); diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html index a77dab8014..3ceb57d196 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html @@ -7,8 +7,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/then <p><strong><code>then()</code> </strong>方法回傳一個 {{domxref("Promise")}} 物件。它接收兩個引數: <code>Promise</code> 在成功及失敗情況時的回呼函式。</p> -<div class="note"> -<p>如果有一個或兩個引數被省略,或為非函式(non-functions),則 <code>then</code> 將處於遺失 handler(s) 的狀態,但不會產生錯誤。若發起 <code>then</code> 之 <code>Promise</code> 採取了一個狀態(實現(<code>fulfillment)</code>或拒絕(<code>rejection))</code>而 <code>then</code> 沒有處理它的函式,一個不具有額外 handlers 的新 <code>Promise</code> 物件將被建立,單純採取原 <code>Promise</code> 其最終狀態。</p> +<div class="notecard note"> +<p><strong>備註:</strong>如果有一個或兩個引數被省略,或為非函式(non-functions),則 <code>then</code> 將處於遺失 handler(s) 的狀態,但不會產生錯誤。若發起 <code>then</code> 之 <code>Promise</code> 採取了一個狀態(實現(<code>fulfillment)</code>或拒絕(<code>rejection))</code>而 <code>then</code> 沒有處理它的函式,一個不具有額外 handlers 的新 <code>Promise</code> 物件將被建立,單純採取原 <code>Promise</code> 其最終狀態。</p> </div> <h2 id="語法">語法</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html index 03cd63effc..7feb69f921 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html @@ -46,81 +46,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Reflect <h2 id="規範">規範</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-reflect-object', 'Reflect')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-reflect-object', 'Reflect')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td>Reflect.enumerate has been removed.</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<p>{{CompatibilityTable}}</p> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Edge</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome(49.0)}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("42")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Edge</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome(49.0)}}</td> - <td>{{CompatChrome(49.0)}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("42")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html index c77d2ea99b..9c6fd56418 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html @@ -32,8 +32,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Set/has <p>回傳 <code>true</code> 如果給定值存在在 <code>Set</code> 物件中;反之回傳 <code>false</code> 。</p> -<div class="blockIndicator note"> -<p><strong>Note:</strong> 技術上來說,<code>has()</code> 使用了 <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality">sameValueZero</a></code> 算法來判斷給定元素的存在與否。</p> +<div class="notecard note"> +<p><strong>備註:</strong>技術上來說,<code>has()</code> 使用了 <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality">sameValueZero</a></code> 算法來判斷給定元素的存在與否。</p> </div> <h2 id="範例">範例</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/index.html index e29b6b8cea..2c9e419b04 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/string/index.html @@ -105,8 +105,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <dl> </dl> -<div class="note"> -<p>和其他語言不同,JavaScript 將單引號字串和雙引號字串是做相同;因此,上述的序列可以在單引號或雙引號中作用。</p> +<div class="notecard note"> +<p><strong>備註:</strong>和其他語言不同,JavaScript 將單引號字串和雙引號字串是做相同;因此,上述的序列可以在單引號或雙引號中作用。</p> </div> <dl> @@ -192,7 +192,7 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <pre class="brush: js">console.log(eval(s2.valueOf())); // 回傳數字 4 </pre> -<div class="note"><strong>注意:</strong> 對於在 JavaScript 中其他可用的字串方法,請參閱這篇文章<a href="/en-US/docs/Web/JavaScript/Typed_arrays/StringView" title="/en-US/docs/Web/JavaScript/Typed_arrays/StringView"><code>StringView</code> – a C-like representation of strings based on typed arrays</a>。</div> +<div class="notecard note"><p><strong>備註:</strong>對於在 JavaScript 中其他可用的字串方法,請參閱這篇文章<a href="/en-US/docs/Web/JavaScript/Typed_arrays/StringView" title="/en-US/docs/Web/JavaScript/Typed_arrays/StringView"><code>StringView</code> – a C-like representation of strings based on typed arrays</a>。</p></div> <h2 id="Properties">屬性</h2> @@ -216,8 +216,8 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <h2 id="String_通用方法"><code>String</code> 通用方法</h2> -<div class="warning"> -<p>字串通用方法是非標準化的、被棄用的,也有近期將被刪除的。</p> +<div class="notecard warning"> +<p><strong>警告:</strong>字串通用方法是非標準化的、被棄用的,也有近期將被刪除的。</p> </div> <p>The <code>String </code>instance methods are also available in Firefox as of JavaScript 1.6 (though not part of the ECMAScript standard) on the String object for applying String methods to any object:</p> diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html index bb053cd10a..e61013fb77 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html @@ -31,63 +31,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/padStart 'abc'.padStart(6,"123465"); // "123abc" </pre> -<h2 id="Specifications">Specifications</h2> +<h2 id="規範">規範</h2> -<p>這個方法還沒有被納入 ECMAScript 標準。現在還只是個<a href="https://github.com/tc39/proposal-string-pad-start-end">提案</a>。</p> +{{Specifications}} -<h2 id="Browser_compatibility">Browser compatibility</h2> +<h2 id="瀏覽器相容性">瀏覽器相容性</h2> -<div>{{CompatibilityTable}}</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Edge</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome(57)}} </td> - <td>15</td> - <td>{{CompatGeckoDesktop(51)}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera(44)}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(57)}}</td> - <td>{{CompatGeckoMobile(51)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="See_also">See also</h2> diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html index 1cc9b1abac..b40013644c 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html @@ -7,8 +7,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/replace <p><strong><code>replace()</code></strong> 方法會傳回一個新字串,此新字串是透過將原字串與 <code>pattern</code> 比對,以 <code>replacement</code> 取代吻合處而生成。<code>pattern</code> 可以是字串或 {{jsxref("RegExp")}},而 <code>replacement</code> 可以是字串或函式(會在每一次匹配時被呼叫)。</p> -<div class="note"> -<p>備註:原始的字串會保持不變。</p> +<div class="notecard note"> +<p><strong>備註:</strong>原始的字串會保持不變。</p> </div> <h2 id="語法">語法</h2> @@ -42,11 +42,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/replace <p>The replacement string can include the following special replacement patterns:</p> -<table class="fullwidth-table"> +<table> <tbody> <tr> - <td class="header">Pattern</td> - <td class="header">Inserts</td> + <th>Pattern</th> + <th>Inserts</th> </tr> <tr> <td><code>$$</code></td> @@ -77,11 +77,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/replace <p>The arguments to the function are as follows:</p> -<table class="fullwidth-table"> +<table> <tbody> <tr> - <td class="header">Possible name</td> - <td class="header">Supplied value</td> + <th>Possible name</th> + <th>Supplied value</th> </tr> <tr> <td><code>match</code></td> diff --git a/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html b/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html index 49be1c3db0..56c14f39ba 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html @@ -84,12 +84,12 @@ Int8Array.prototype.foo = 'bar'; <table class="standard-table"> <tbody> <tr> - <td class="header">Type</td> - <td class="header">Value Range</td> - <td class="header">Size in bytes</td> - <td class="header">Description</td> - <td class="header">Web IDL type</td> - <td class="header">Equivalent C type</td> + <th>Type</th> + <th>Value Range</th> + <th>Size in bytes</th> + <th>Description</th> + <th>Web IDL type</th> + <th>Equivalent C type</th> </tr> <tr> <td>{{jsxref("Int8Array")}}</td> diff --git a/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html b/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html index f352c84d71..f183c412ce 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html @@ -26,8 +26,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/undefined <p>A variable that has not been assigned a value is of type undefined. A method or statement also returns <code>undefined</code> if the variable that is being evaluated does not have an assigned value. A function returns <code>undefined</code> if a value was not {{jsxref("Statements/return", "returned")}}.</p> -<div class="warning"> -<p>While it is possible to use it as an {{Glossary("Identifier", "identifier")}} (variable name) in any scope other than the global scope (because <code>undefined</code> is not a {{jsxref("Reserved_Words", "reserved word")}}), doing so is a very bad idea that will make your code difficult to maintain and debug.</p> +<div class="notecard warning"> +<p><strong>Warning:</strong> While it is possible to use it as an {{Glossary("Identifier", "identifier")}} (variable name) in any scope other than the global scope (because <code>undefined</code> is not a {{jsxref("Reserved_Words", "reserved word")}}), doing so is a very bad idea that will make your code difficult to maintain and debug.</p> <pre class="brush: js">//DON'T DO THIS @@ -54,8 +54,8 @@ else { } </pre> -<div class="note"> -<p>備註:The strict equality operator rather than the standard equality operator must be used here, because <code>x == undefined</code> also checks whether <code>x</code> is <code>null</code>, while strict equality doesn't. <code>null</code> is not equivalent to <code>undefined</code>. See {{jsxref("Operators/Comparison_Operators", "comparison operators")}} for details.</p> +<div class="notecard note"> +<p><strong>Note:</strong> The strict equality operator rather than the standard equality operator must be used here, because <code>x == undefined</code> also checks whether <code>x</code> is <code>null</code>, while strict equality doesn't. <code>null</code> is not equivalent to <code>undefined</code>. See {{jsxref("Operators/Comparison_Operators", "comparison operators")}} for details.</p> </div> <h3 id="Typeof_operator_and_undefined"><code>Typeof</code> operator and <code>undefined</code></h3> |