diff options
author | t7yang <t7yang@gmail.com> | 2022-01-10 08:38:08 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | f45e9e070c93ebbd83d488bdd775987a4d75c201 (patch) | |
tree | aacef5edaf768a188cadc46860f5b6aaa74f39ef /files | |
parent | 8ccfa93045a6c119303566370999f59a0aae3b25 (diff) | |
download | translated-content-f45e9e070c93ebbd83d488bdd775987a4d75c201.tar.gz translated-content-f45e9e070c93ebbd83d488bdd775987a4d75c201.tar.bz2 translated-content-f45e9e070c93ebbd83d488bdd775987a4d75c201.zip |
fix yari h2m dry run errors
Diffstat (limited to 'files')
98 files changed, 814 insertions, 3735 deletions
diff --git a/files/zh-tw/web/javascript/a_re-introduction_to_javascript/index.html b/files/zh-tw/web/javascript/a_re-introduction_to_javascript/index.html index fe062e2ba6..e563166720 100644 --- a/files/zh-tw/web/javascript/a_re-introduction_to_javascript/index.html +++ b/files/zh-tw/web/javascript/a_re-introduction_to_javascript/index.html @@ -896,7 +896,7 @@ y(7) <p>避免閉包還有另外一種方法:利用 <code>window.onunload</code> 事件消除相互參照。許多事件函示庫都會自動這麼做。</p> -<div class="originaldocinfo"> +<div> <h2 id="原始文件資訊">原始文件資訊</h2> <ul> @@ -906,5 +906,3 @@ y(7) <li>更多資訊:其他關於這份教學的資訊(以及原作者所用的投影片)請前往原作者的網誌:<a class="external" href="http://simon.incutio.com/archive/2006/03/07/etech">Etech weblog</a>。</li> </ul> </div> - -<p> </p> diff --git a/files/zh-tw/web/javascript/closures/index.html b/files/zh-tw/web/javascript/closures/index.html index fbac2c5b07..de8cb67e54 100644 --- a/files/zh-tw/web/javascript/closures/index.html +++ b/files/zh-tw/web/javascript/closures/index.html @@ -164,8 +164,8 @@ console.log(counter.value()); // logs 1 <p>這三個公有函式,皆為共享同一個環境的閉包。由於 JavaScript 的語法作用域,它們都能訪問 <code>privateCounter</code> 變數與 <code>changeBy</code> 函式。</p> -<div class="note"> -<p>你應該也發現到我們定義了建立 counter 的匿名函式、而我們接著呼叫它,並給<code>counter</code> 變數指派了回傳值。我們也能在分離的變數 <code>makeCounter</code> 儲存函式並用其建立數個 counter。</p> +<div class="notecard note"> +<p><strong>備註:</strong>你應該也發現到我們定義了建立 counter 的匿名函式、而我們接著呼叫它,並給<code>counter</code> 變數指派了回傳值。我們也能在分離的變數 <code>makeCounter</code> 儲存函式並用其建立數個 counter。</p> </div> <pre class="brush: js">var makeCounter = function() { @@ -199,8 +199,8 @@ alert(counter2.value()); /* Alerts 0 */ <p>請注意 <code>counter1</code> 與 <code>counter2</code> 這兩個計數器是如何維護其獨立性的。每個閉包都以各自的閉包,在參照不同版本的 <code>privateCounter</code> 變數。每當呼叫其中一個計數器時,它會透過該變數的數值變更,改變語法作用域的環境。不過,在其中一個閉包的變數值改時,其他閉包的數值並不會受到影響。</p> -<div class="note"> -<p>使用這種方法的閉包,提供了一些與物件導向程式設計的益處,尤其是資料隱藏與封裝。</p> +<div class="notecard note"> +<p><strong>備註:</strong>使用這種方法的閉包,提供了一些與物件導向程式設計的益處,尤其是資料隱藏與封裝。</p> </div> <h2 id="在迴圈建立閉包:一個常見錯誤">在迴圈建立閉包:一個常見錯誤</h2> diff --git a/files/zh-tw/web/javascript/data_structures/index.html b/files/zh-tw/web/javascript/data_structures/index.html index 83b215697f..0ff027ee5a 100644 --- a/files/zh-tw/web/javascript/data_structures/index.html +++ b/files/zh-tw/web/javascript/data_structures/index.html @@ -212,8 +212,8 @@ Infinity </tbody> </table> -<div class="note"> -<p><strong>Note: </strong>Attribute is usually used by JavaScript engine, so you can't directly access it(see more about <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty()</a>).That's why the attribute is put in double square brackets instead of single.</p> +<div class="notecard note"> +<p><strong>備註:</strong>Attribute is usually used by JavaScript engine, so you can't directly access it(see more about <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty()</a>).That's why the attribute is put in double square brackets instead of single.</p> </div> <h3 id="Normal_objects_and_functions">"Normal" objects, and functions</h3> diff --git a/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.html b/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.html index c140d1a991..b26a576309 100644 --- a/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.html +++ b/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.html @@ -229,7 +229,9 @@ throw true; // True/False throw {toString: function() { return "我是物件!"; } }; </pre> -<div class="note"><strong>備註:</strong>您可以在拋出例外時指定物件。 然後,可以在 catch 區塊中引用對象的屬性。</div> +<div class="notecard note"> + <p><strong>備註:</strong>您可以在拋出例外時指定物件。 然後,可以在 catch 區塊中引用對象的屬性。</p> +</div> <pre class="brush: js">// 創建類型爲 UserException 的物件 function UserException(message) { @@ -398,7 +400,7 @@ catch (e) { <li><em>settled</em>:已完成,表示 Promise 狀態為已實現或已拒絕,但不是等待中。</li> </ul> -<p><img alt="" src="https://mdn.mozillademos.org/files/8633/promises.png" style="height: 297px; width: 801px;"></p> +<p><img alt="promises" src="https://mdn.mozillademos.org/files/8633/promises.png"></p> <h3 id="使用_XHR_載入圖檔">使用 XHR 載入圖檔</h3> diff --git a/files/zh-tw/web/javascript/guide/details_of_the_object_model/index.html b/files/zh-tw/web/javascript/guide/details_of_the_object_model/index.html index ae69cc38f4..ba436da83c 100644 --- a/files/zh-tw/web/javascript/guide/details_of_the_object_model/index.html +++ b/files/zh-tw/web/javascript/guide/details_of_the_object_model/index.html @@ -40,7 +40,7 @@ translation_of: Web/JavaScript/Guide/Details_of_the_Object_Model <p>下面的表格列出了上述區別。本節的後續部分將描述有關使用 JavaScript 構建函數和原型創建物件層級結構的詳細資訊,並與在 Java 中的做法做對比。</p> -<table class="fullwidth-table"> +<table> <caption>表 8.1 基於類(Java)和基於原型(JavaScript)的物件系統的比較</caption> <thead> <tr> @@ -80,7 +80,7 @@ translation_of: Web/JavaScript/Guide/Details_of_the_Object_Model <p>本節的餘下部分將使用如下圖所示的僱員層級結構。</p> -<p><img alt="" class="internal" src="/@api/deki/files/4452/=figure8.1.png" style="height: 194px; width: 281px;"></p> +<p><img alt="" class="internal" src="/@api/deki/files/4452/=figure8.1.png"></p> <p><small><strong>圖例 8.1:一個簡單的物件層級</strong></small></p> @@ -102,7 +102,7 @@ translation_of: Web/JavaScript/Guide/Details_of_the_Object_Model <p>在 真實的應用程式中,您很可能想定義允許在創建物件時給出屬性值的建構函數。(參見 <a href="#更靈活的建構函數">更靈活的建構函數</a> 獲得進一步的資訊)。對於現在而言,這些簡單的定義示範了繼承是如何發生的。</p> -<p><img alt="figure8.2.png" class="default internal" src="/@api/deki/files/4390/=figure8.2.png"><br> +<p><img alt="figure8.2.png" src="/@api/deki/files/4390/=figure8.2.png"><br> <small><strong>圖例 8.2:Employee 物件定義</strong></small></p> <p>以下 <code>Employee</code> 的 Java 和 JavaScript 的定義相類似。唯一的不同是在 Java 中需要指定每個屬性的類型,而在 JavaScript 中則不必指定,同時 Java 的類必須創建一個顯式的建構函數方法。</p> @@ -238,8 +238,8 @@ public class Engineer extends WorkerBee { <p>{{ note('術語 <em><em>實例(instance)</em></em>在 基於類的語言中具有特定的技術含義。在這些語言中,實例是指類的個體成員,與類有著根本性的不同。在 JavaScript 中,“實例”並不具有這種技術含義,因為 JavaScript 中不存在類和實例之間的這種差異。然而,在談論 JavaScript 時,“實例”可以非正式地用於表示用特定的建構函數創建的物件。所以,在這個例子中,你可以非正式地 <code>jane</code> 是 <code>Engineer</code> 的一個實例。與之類似,儘管術語<em>父(parent)</em>,<em>子(child)</em>,<em>祖先(ancestor)</em>,和<em>後代(descendant)</em>在 JavaScript 中並沒有正式的含義,您可以非正式地使用這些術語用於指代原型鏈中處於更高層次或者更低層次的物件。') }}</p> -<p><img alt="figure8.3.png" class="default internal" id="figure8.3" src="/@api/deki/files/4403/=figure8.3.png"><br> - <a><small><strong>圖例 8.3:通過簡單的定義創建物件</strong></small></a></p> +<p><img alt="figure8.3.png" src="/@api/deki/files/4403/=figure8.3.png"><br> + <small><strong>圖例 8.3:通過簡單的定義創建物件</strong></small></p> <h2 id="物件的屬性">物件的屬性</h2> @@ -285,15 +285,15 @@ mark.projects = ["navigator"];</pre> <p>一旦 JavaScript 執行該語句,則 <code>mark</code> 物件也將具有 <code>specialty</code> 屬性,其值為 <code>"none"</code>。下圖展現了在 <code>Employee</code> 原型中添加該屬性,然後在 <code>Engineer</code> 的原型中重載該屬性的效果。</p> -<p><img alt="" class="internal" src="/@api/deki/files/4422/=figure8.4.png" style="height: 519px; width: 833px;"><br> +<p><img alt="" class="internal" src="/@api/deki/files/4422/=figure8.4.png"><br> <small><strong>Figure 8.4: Adding properties</strong></small></p> -<h2 id="more_flexible_constructors"><a>更靈活的建構函數</a></h2> +<h2 id="more_flexible_constructors">更靈活的建構函數</h2> <p>到目前為止所展現的建構函數不允許在創建新的實例時指定屬性值。正如 Java 一樣,可以為建構函數提供參數以便初始化實例的屬性值。下圖展現其中一種做法。</p> -<p><img alt="" class="internal" src="/@api/deki/files/4423/=figure8.5.png" style="height: 481px; width: 1012px;"><br> - <a><small><strong>Figure 8.5: Specifying properties in a constructor, take 1</strong></small></a></p> +<p><img alt="" class="internal" src="/@api/deki/files/4423/=figure8.5.png"><br> + <small><strong>Figure 8.5: Specifying properties in a constructor, take 1</strong></small></p> <p>下面的表格中羅列了這些物件在 Java 和 JavaScript 中的定義。</p> @@ -413,7 +413,7 @@ jane.machine == "belau" <p>到目前為止,建構函數已經能夠創建一個普通物件,然後為新物件指定本地的屬性和屬性值。您還可以通過直接調用原型鏈上的更高層次物件的建構函數,讓建構函數添加更多的屬性。下面的圖例展現這種新定義。</p> -<p><img alt="" class="internal" src="/@api/deki/files/4430/=figure8.6.png" style="height: 534px; width: 1063px;"><br> +<p><img alt="" class="internal" src="/@api/deki/files/4430/=figure8.6.png"><br> <small><strong>Figure 8.6 Specifying properties in a constructor, take 2</strong></small></p> <p>讓我們仔細看看這些定義的其中之一。以下是 <code>Engineer</code> 建構函數的定義:</p> @@ -607,7 +607,9 @@ chris.__proto__.__proto__.__proto__.__proto__.__proto__ == null; } </pre> -<div class="note"><strong>Note:</strong> 在上面的實現中,檢查物件的類型是否為 "xml" 的目的在於解決新近版本的 JavaScript 中表達 XML 物件的特異之處。如果您想瞭解其中瑣碎細節,可以參考 {{ bug(634150) }}。</div> +<div class="notecard note"> + <p><strong>備註:</strong> 在上面的實現中,檢查物件的類型是否為 "xml" 的目的在於解決新近版本的 JavaScript 中表達 XML 物件的特異之處。如果您想瞭解其中瑣碎細節,可以參考 {{ bug(634150) }}。</p> +</div> <pre class="brush: js">instanceOf (chris, Engineer) instanceOf (chris, WorkerBee) diff --git a/files/zh-tw/web/javascript/guide/expressions_and_operators/index.html b/files/zh-tw/web/javascript/guide/expressions_and_operators/index.html index 4e0c8655bc..77075cdd2e 100644 --- a/files/zh-tw/web/javascript/guide/expressions_and_operators/index.html +++ b/files/zh-tw/web/javascript/guide/expressions_and_operators/index.html @@ -212,8 +212,8 @@ var var2 = 4; </tbody> </table> -<div class="note"> -<p><strong>筆記: </strong>(<strong>=>)不是運算子,是</strong> <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭頭函式。</a></p> +<div class="notecard note"> +<p><strong>備註:</strong>(<strong>=>)不是運算子,是</strong> <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭頭函式。</a></p> </div> <h3 id="算術運算子">算術運算子</h3> @@ -226,7 +226,7 @@ var var2 = 4; <p>除了標準的算術運算子外 (+, -, * /), JavaScript 提供以下表中的算術運算子:</p> -<table class="fullwidth-table"> +<table> <caption>算術運算子</caption> <thead> <tr> @@ -388,7 +388,7 @@ var var2 = 4; <p>移動運算子在下表被列出.</p> -<table class="fullwidth-table"> +<table> <caption>位元移動運算子</caption> <thead> <tr> @@ -421,7 +421,7 @@ var var2 = 4; <p><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators">邏輯運算子</a> 通常被用於布林(邏輯)值; 使用於 布林(邏輯)值時, 它們會回傳布林型態的值。 然而,<code>&&</code> 和 <code>||</code> 運算子實際上是回傳兩指定運算元之一,因此用於非布林型態值時,它可能會回傳一個非布林型態的值。 邏輯運算子將在下表中被詳細解釋。</p> -<table class="fullwidth-table"> +<table> <caption>Logical operators</caption> <thead> <tr> diff --git a/files/zh-tw/web/javascript/guide/functions/index.html b/files/zh-tw/web/javascript/guide/functions/index.html index f71ccfa1e9..af19983b6f 100644 --- a/files/zh-tw/web/javascript/guide/functions/index.html +++ b/files/zh-tw/web/javascript/guide/functions/index.html @@ -72,12 +72,8 @@ y = mycar.make; // y 的值還是 "Honda" </pre> <pre class="brush: js">var square = function(number) {return number * number}; var x = square(4) //x 的值為 16</pre> -<div class="almost_half_cell" id="gt-res-content"> <div>必要時,函式名稱可與函式表達式同時存在,並且可以用於在函式內部代指其本身(遞迴):</div> -<div> </div> -</div> - <pre class="brush: js">var factorial = function fac(n) {return n<2 ? 1 : n*fac(n-1)}; console.log(factorial(3)); @@ -150,7 +146,7 @@ e = factorial(5); // e gets the value 120 <p>There are other ways to call functions. There are often cases where a function needs to be called dynamically, or the number of arguments to a function vary, or in which the context of the function call needs to be set to a specific object determined at runtime. It turns out that functions are, themselves, objects, and these objects in turn have methods (see the <a href="/en-US/docs/JavaScript/Guide/Obsolete_Pages/Predefined_Core_Objects/Function_Object" title="Function Object"><code>Function</code> object</a>). One of these, the <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply" title="apply"><code>apply()</code></a> method, can be used to achieve this goal.</p> -<h2 class="deki-transform" id="Function_scope">Function scope</h2> +<h2 id="Function_scope">Function scope</h2> <p>Variables defined inside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function. However, a function can access all variables and functions defined inside the scope in which it is defined. In other words, a function defined in the global scope can access all variables defined in the global scope. A function defined inside another function can also access all variables defined in it's parent function and any other variable to which the parent function has access.</p> diff --git a/files/zh-tw/web/javascript/guide/grammar_and_types/index.html b/files/zh-tw/web/javascript/guide/grammar_and_types/index.html index 04f4818cdb..a5200c39ec 100644 --- a/files/zh-tw/web/javascript/guide/grammar_and_types/index.html +++ b/files/zh-tw/web/javascript/guide/grammar_and_types/index.html @@ -335,8 +335,8 @@ y = 42 + " is the answer" // "42 is the answer" <pre class="brush: js">var coffees = ['French Roast', 'Colombian', 'Kona']; </pre> -<div class="note"> -<p><strong>Note :</strong> An array literal is a type of object initializer. See <a href="/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Using_object_initializers">Using Object Initializers</a>.</p> +<div class="notecard note"> +<p><strong>Note:</strong> An array literal is a type of object initializer. See <a href="/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Using_object_initializers">Using Object Initializers</a>.</p> </div> <p>If an array is created using a literal in a top-level script, JavaScript interprets the array each time it evaluates the expression containing the array literal. In addition, a literal used in a function is created each time the function is called.</p> @@ -354,8 +354,8 @@ y = 42 + " is the answer" // "42 is the answer" <p>If you include a trailing comma at the end of the list of elements, the comma is ignored. In the following example, the length of the array is three. There is no <code>myList[3]</code>. All other commas in the list indicate a new element.</p> -<div class="note"> -<p><strong>Note :</strong> Trailing commas can create errors in older browser versions and it is a best practice to remove them.</p> +<div class="notecard note"> +<p><strong>Note:</strong> Trailing commas can create errors in older browser versions and it is a best practice to remove them.</p> </div> <pre class="brush: js">var myList = ['home', , 'school', ]; diff --git a/files/zh-tw/web/javascript/guide/index.html b/files/zh-tw/web/javascript/guide/index.html index c7ba53958a..23d3b2a340 100644 --- a/files/zh-tw/web/javascript/guide/index.html +++ b/files/zh-tw/web/javascript/guide/index.html @@ -11,106 +11,168 @@ translation_of: Web/JavaScript/Guide <p>本指南區分成以下數個章節:</p> -<ul class="card-grid"> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction">簡介</a> - - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Where_to_find_JavaScript_information">關於本指南</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#What_is_JavaScript">關於 JavaScript</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_Java">JavaScript 與 Java</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_the_ECMAScript_Specification">ECMAScript</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Getting_started_with_JavaScript">工具</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Hello_world">Hello World</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types">語法與型別</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Basics">基礎語法 & 註解</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Declarations">宣告</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Variable_scope">變數範圍</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Variable_hoisting">變數提升(Hoisting)</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types">資料結構與型態</a><br> - <a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#%E5%AD%97%E9%9D%A2%E5%80%BC%EF%BC%88Literals%EF%BC%89">字面值</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling">流程控制與錯誤處理</a> - <p><code><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#if...else_statement">if...else</a></code><br> - <code><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#switch_statement">switch</a></code><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Exception_handling_statements"><code>try</code>/<code>catch</code>/<code>throw</code></a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Utilizing_Error_objects">Error 物件</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Promises">Promises</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration">迴圈與迭代</a> - <p><code><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for_statement">for</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#while_statement">while</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#do...while_statement">do...while</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#break_statement">break</a>/<a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#continue_statement">continue</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_statement">for..in</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement">for..of</a></code></p> - </li> +<h2 id="簡介">簡介</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction">簡介</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Where_to_find_JavaScript_information">關於本指南</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#What_is_JavaScript">關於 JavaScript</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_Java">JavaScript 與 Java</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_the_ECMAScript_Specification">ECMAScript</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Getting_started_with_JavaScript">工具</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Introduction#Hello_world">Hello World</a></li> +</ul> + +<h2 id="語法與型別">語法與型別</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types">語法與型別</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Basics">基礎語法 & 註解</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Declarations">宣告</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Variable_scope">變數範圍</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Variable_hoisting">變數提升(Hoisting)</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types">資料結構與型態</a></li> + <li><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#%E5%AD%97%E9%9D%A2%E5%80%BC%EF%BC%88Literals%EF%BC%89">字面值</a></li> +</ul> + +<h2 id="流程控制與錯誤處理">流程控制與錯誤處理</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling">流程控制與錯誤處理</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#if...else_statement"><code>if...else</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#switch_statement"><code>switch</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Exception_handling_statements"><code>try</code>/<code>catch</code>/<code>throw</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Utilizing_Error_objects">Error 物件</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Promises">Promises</a></li> +</ul> + +<h2 id="迴圈與迭代">迴圈與迭代</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration">迴圈與迭代</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for_statement"><code>for</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#while_statement"><code>while</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#do...while_statement"><code>do...while</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#break_statement"><code>break</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#continue_statement"><code>continue</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_statement"><code>for..in</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement"><code>for..of</code></a></li> +</ul> + +<h2 id="函數">函數</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Functions">函數</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Defining_functions">定義函數</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Calling_functions">呼叫函數</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Function_scope">函數範圍</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Closures">閉包(Closure)</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Using_the_arguments_object">參數值</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Function_parameters">參數</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Arrow_functions">箭頭函數</a></li> +</ul> + +<h2 id="運算式與運算子">運算式與運算子</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators">運算式與運算子</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment_operators">賦值</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison_operators">比較</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Arithmetic_operators">算數運算子</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise_operators">位元</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Logical_operators">邏輯運算子</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Conditional_(ternary)_operator">條件(三元)運算子</a></li> +</ul> + +<h2 id="數字與日期">數字與日期</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates">數字與日期</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Numbers">數字書寫法</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Number_object"><code>Number</code> 物件</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Math_object"><code>Math</code> 物件</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Date_object"><code>Date</code> 物件</a></li> +</ul> + +<h2 id="文字格式">文字格式</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting">文字格式</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#String_literals">字串書寫法</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#String_objects"><code>String</code> 物件</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#Multi-line_template_literals">模板書寫法</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#Internationalization">國際化</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions">正規表示法</a></li> +</ul> + +<h2 id="具索引的集合">具索引的集合</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting">文字格式</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Array_object">陣列</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Typed_Arrays">型態化陣列</a></li> +</ul> + +<h2 id="具鍵值的集合">具鍵值的集合</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections">具鍵值的集合</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#Map_object"><code>Map</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#WeakMap_object"><code>WeakMap</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#Set_object"><code>Set</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#WeakSet_object"><code>WeakSet</code></a></li> +</ul> + +<h2 id="使用物件">使用物件</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects">使用物件</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Objects_and_properties">物件與屬性</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Creating_new_objects">建立物件</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_methods">定義方法</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">取值器與設值器</a></li> </ul> -<ul class="card-grid"> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions">函數</a> - - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Defining_functions">定義函數</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Calling_functions">呼叫函數</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Function_scope">函數範圍</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Closures">閉包(Closure)</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Using_the_arguments_object">參數值</a> & <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Function_parameters">參數</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Arrow_functions">箭頭函數</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators">運算式與運算子</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment_operators">賦值</a> & <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison_operators">比較</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Arithmetic_operators">算數運算子</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise_operators">位元</a> & <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Logical_operators">邏輯運算子</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Conditional_(ternary)_operator">條件(三元)運算子</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates">數字與日期</a><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Numbers">數字書寫法</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Number_object"><code>Number</code> 物件</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Math_object"><code>Math</code> 物件</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Numbers_and_dates#Date_object"><code>Date</code> 物件</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting">文字格式</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#String_literals">字串書寫法</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#String_objects"><code>String</code> 物件</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#Multi-line_template_literals">模板書寫法</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Text_formatting#Internationalization">國際化</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions">正規表示法</a></p> - </li> +<h2 id="深入了解物件模型">深入了解物件模型</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model">深入了解物件模型</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Class-based_vs._prototype-based_languages">以原形(Prototype)為基礎的 OOP</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Creating_the_hierarchy">建立物件層級</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Property_inheritance_revisited">繼承</a></li> </ul> -<ul class="card-grid"> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections">具索引的集合</a> - - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Array_object">陣列</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Typed_Arrays">型態化陣列</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections">具鍵值的集合</a> - <p><code><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#Map_object">Map</a></code><br> - <code><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#WeakMap_object">WeakMap</a></code><br> - <code><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#Set_object">Set</a></code><br> - <code><a href="/zh-TW/docs/Web/JavaScript/Guide/Keyed_collections#WeakSet_object">WeakSet</a></code></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects">使用物件</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Objects_and_properties">物件與屬性</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Creating_new_objects">建立物件</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_methods">定義方法</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">取值器與設值器</a></p> - </li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model">深入了解物件模型</a> - <p><a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Class-based_vs._prototype-based_languages">以原形(Prototype)為基礎的 OOP</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Creating_the_hierarchy">建立物件層級</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#Property_inheritance_revisited">繼承</a></p> - </li> +<h2 id="迭代器與產生器">迭代器與產生器</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators">迭代器與產生器</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterators">迭代器(Iterator)</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables">可迭代型態(Iterable)</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Generators">產生器(Generator)</a></li> </ul> -<ul class="card-grid"> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators">迭代器與產生器</a><a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterators">迭代器(Iterator)</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables">可迭代型態(Iterable)</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Iterators_and_Generators#Generators">產生器(Generator)</a></li> - <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming">Meta 程式設計</a> - <p><code><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Proxies">Proxy</a></code><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Handlers_and_traps">Handler 與 Trap</a><br> - <a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Revocable_Proxy">Revocable Proxy</a><br> - <code><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Reflection">Reflect</a></code></p> - </li> +<h2 id="Meta 程式設計">Meta 程式設計</h2> + +<p>概述:<a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming">Meta 程式設計</a></p> + +<ul> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Proxies"><code>Proxy</code></a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Handlers_and_traps">Handler 與 Trap</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Revocable_Proxy">Revocable Proxy</a></li> + <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Meta_programming#Reflection"><code>Reflect</code></a></li> </ul> <p>{{Next("Web/JavaScript/Guide/Introduction")}}</p> diff --git a/files/zh-tw/web/javascript/guide/indexed_collections/index.html b/files/zh-tw/web/javascript/guide/indexed_collections/index.html index a5e843c220..26079e8c09 100644 --- a/files/zh-tw/web/javascript/guide/indexed_collections/index.html +++ b/files/zh-tw/web/javascript/guide/indexed_collections/index.html @@ -36,8 +36,8 @@ var arr = []; arr.length = arrayLength; </pre> -<div class="note"> -<p><strong>Note :</strong> in the above code, <code>arrayLength</code> must be a <code>Number</code>. Otherwise, an array with a single element (the provided value) will be created. Calling <code>arr.length</code> will return <code>arrayLength</code>, but the array actually contains empty (undefined) elements. Running a {{jsxref("Statements/for...in","for...in")}} loop on the array will return none of the array's elements.</p> +<div class="notecard note"> +<p><strong>Note:</strong> in the above code, <code>arrayLength</code> must be a <code>Number</code>. Otherwise, an array with a single element (the provided value) will be created. Calling <code>arr.length</code> will return <code>arrayLength</code>, but the array actually contains empty (undefined) elements. Running a {{jsxref("Statements/for...in","for...in")}} loop on the array will return none of the array's elements.</p> </div> <p>In addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object:</p> @@ -79,8 +79,8 @@ emp[1] = 'Phil Lesh'; emp[2] = 'August West'; </pre> -<div class="note"> -<p><strong>Note :</strong> if you supply a non-integer value to the array operator in the code above, a property will be created in the object representing the array, instead of an array element.</p> +<div class="notecard note"> +<p><strong>Note:</strong> if you supply a non-integer value to the array operator in the code above, a property will be created in the object representing the array, instead of an array element.</p> </div> <pre class="brush: js">var arr = []; @@ -104,8 +104,8 @@ var myArray = ['Mango', 'Apple', 'Orange']; <p>You then refer to the first element of the array as <code>myArray[0]</code> and the second element of the array as <code>myArray[1]</code>. The index of the elements begins with zero.</p> -<div class="note"> -<p><strong>Note :</strong> the array operator (square brackets) is also used for accessing the array's properties (arrays are also objects in JavaScript). For example,</p> +<div class="notecard note"> +<p><strong>Note:</strong> the array operator (square brackets) is also used for accessing the array's properties (arrays are also objects in JavaScript). For example,</p> </div> <pre class="brush: js">var arr = ['one', 'two', 'three']; @@ -433,7 +433,7 @@ Row 3: [3, 0] [3, 1] [3, 2] [3, 3] <p>To achieve maximum flexibility and efficiency, JavaScript typed arrays split the implementation into <strong>buffers</strong> and <strong>views</strong>. A buffer (implemented by the {{jsxref("ArrayBuffer")}} object) is an object representing a chunk of data; it has no format to speak of, and offers no mechanism for accessing its contents. In order to access the memory contained in a buffer, you need to use a view. A view provides a context — that is, a data type, starting offset, and number of elements — that turns the data into an actual typed array.</p> -<p><img alt="Typed arrays in an ArrayBuffer" src="https://mdn.mozillademos.org/files/8629/typed_arrays.png" style="height: 278px; width: 666px;"></p> +<p><img alt="Typed arrays in an ArrayBuffer" src="https://mdn.mozillademos.org/files/8629/typed_arrays.png"></p> <h3 id="ArrayBuffer">ArrayBuffer</h3> diff --git a/files/zh-tw/web/javascript/guide/introduction/index.html b/files/zh-tw/web/javascript/guide/introduction/index.html index ae980e77b0..fee75789ba 100644 --- a/files/zh-tw/web/javascript/guide/introduction/index.html +++ b/files/zh-tw/web/javascript/guide/introduction/index.html @@ -154,7 +154,7 @@ translation_of: Web/JavaScript/Guide/Introduction </tbody> </table> -<div class="note">注意:ECMA-262 第2版是由已修正錯誤的第1版並加上些微的更動構成。現今由 Ecma International 的 TC39 工作組(TC39 Working Group)所發行的版本是 ECMAScript 5.1版</div> +<div class="notecard note"><p><strong>備註:</strong>ECMA-262 第2版是由已修正錯誤的第1版並加上些微的更動構成。現今由 Ecma International 的 TC39 工作組(TC39 Working Group)所發行的版本是 ECMAScript 5.1版</p></div> <p><a href="/zh-TW/docs/JavaScript/Reference" title="JavaScript/Reference">JavaScript Reference</a> 指出了哪些 JavaScript 的特性是相容於 ECMAScript 的。</p> diff --git a/files/zh-tw/web/javascript/guide/iterators_and_generators/index.html b/files/zh-tw/web/javascript/guide/iterators_and_generators/index.html index 8c53a56eb2..5d5fb327c6 100644 --- a/files/zh-tw/web/javascript/guide/iterators_and_generators/index.html +++ b/files/zh-tw/web/javascript/guide/iterators_and_generators/index.html @@ -70,8 +70,8 @@ console.log("Iterated over sequence of size: ", result.value); // 5 </pre> -<div class="note"> -<p>It is not possible to know reflectively whether a particular object is an iterator. If you need to do this, use <a href="#Iterables">Iterables</a>.</p> +<div class="notecard note"> +<p><strong>Note:</strong> It is not possible to know reflectively whether a particular object is an iterator. If you need to do this, use <a href="#Iterables">Iterables</a>.</p> </div> <h2 id="Generator_functions">Generator functions</h2> diff --git a/files/zh-tw/web/javascript/guide/using_promises/index.html b/files/zh-tw/web/javascript/guide/using_promises/index.html index 1df6376ffd..71b99084e7 100644 --- a/files/zh-tw/web/javascript/guide/using_promises/index.html +++ b/files/zh-tw/web/javascript/guide/using_promises/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Guide/Using_promises <p>舉例來說,下方的範例若用舊方式應該會有兩個 Callback,並根據成功或失敗來決定使用哪個:</p> -<pre class="brush: js line-numbers language-js">function successCallback(result) { +<pre class="brush: js">function successCallback(result) { console.log("It succeeded with " + result); } @@ -24,12 +24,12 @@ doSomething(successCallback, failureCallback); <p>而新作法會回傳一個 Promise,這樣你就可以附加 Callback:</p> -<pre class="brush: js line-numbers language-js">let promise = doSomething(); +<pre class="brush: js">let promise = doSomething(); promise.then(successCallback, failureCallback);</pre> <p>再簡單點:</p> -<pre class="brush: js line-numbers language-js">doSomething().then(successCallback, failureCallback);</pre> +<pre class="brush: js">doSomething().then(successCallback, failureCallback);</pre> <p>我們稱之為 <em>非同步函數呼叫</em>。這個做法有許多好處,我們接下來看看。</p> diff --git a/files/zh-tw/web/javascript/guide/working_with_objects/index.html b/files/zh-tw/web/javascript/guide/working_with_objects/index.html index ec531a1004..31b9403a01 100644 --- a/files/zh-tw/web/javascript/guide/working_with_objects/index.html +++ b/files/zh-tw/web/javascript/guide/working_with_objects/index.html @@ -124,7 +124,7 @@ myCar.year = 1969</pre> <p>JavaScript has a number of predefined objects. In addition, you can create your own objects. You can create an object using an <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer</a>. Alternatively, you can first create a constructor function and then instantiate an object invoking that function in conjunction with the <code>new</code> operator.</p> -<h3 id="Using_object_initializers"><a>Using object initializers</a></h3> +<h3 id="Using_object_initializers">Using object initializers</h3> <p>In addition to creating objects using a constructor function, you can create objects using an <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer</a>. Using object initializers is sometimes referred to as creating objects with literal notation. "Object initializer" is consistent with the terminology used by C++.</p> diff --git a/files/zh-tw/web/javascript/index.html b/files/zh-tw/web/javascript/index.html index cc2b91de2e..13304860e0 100644 --- a/files/zh-tw/web/javascript/index.html +++ b/files/zh-tw/web/javascript/index.html @@ -20,8 +20,6 @@ translation_of: Web/JavaScript <p>別搞混了 JavaScript 和 <a href="https://en.wikipedia.org/wiki/Java_(programming_language)">Java 程式語言</a>。雖然 "Java" 和 "JavaScript" 都是 Oracle 公司在美國和其他國家的商標或註冊商標,但兩個語言有著非常不同的語法、語意和用途。</p> </div> -<div class="column-container"> -<div class="column-half"> <h2 id="教學">教學</h2> <p>透過指南和教學來學習編寫 JavaScript。</p> @@ -77,9 +75,7 @@ translation_of: Web/JavaScript <dt><a href="/zh-TW/docs/Web/JavaScript/EventLoop">併行模組和事件循環</a></dt> <dd>JavaScript 具有基於「事件循環」的併行模組。</dd> </dl> -</div> -<div class="column-half"> <h2 id="參考">參考</h2> <p>瀏覽完整的 <a href="/zh-TW/docs/Web/JavaScript/Reference">JavaScript 參考文件</a>。</p> @@ -104,7 +100,7 @@ translation_of: Web/JavaScript <dd><a href="/zh-TW/docs/Tools/Scratchpad">程式碼速記本 (Scratchpad)</a>、<a href="/zh-TW/docs/Tools/Web_Console">網頁主控台 (Web Console)</a>、<a href="/zh-TW/docs/Tools/Profiler">JavaScript 效能分析器(JavaScript Profiler)</a>、<a href="/zh-TW/docs/Tools/Debugger">除錯器 (Debugger)</a> 等等。</dd> <dt><a href="/zh-TW/docs/Web/JavaScript/Shells">JavaScript Shell</a></dt> <dd>JavaScript Shell 讓你更快的測試片段的 JavaScript。</dd> - <dt><a href="https://togetherjs.com/">TogetherJS</a><a title="Paste">Paste</a></dt> + <dt><a href="https://togetherjs.com/">TogetherJS</a>Paste</dt> <dd>合作更簡單了。藉著在你的網站增加 TogetherJS,你的用戶們能在網站上互助 in real time!</dd> <dt><a href="http://stackoverflow.com/questions/tagged/javascript">Stack Overflow</a></dt> <dd>Stack Overflow 上有關 JavaScript 的問題。</dd> @@ -113,5 +109,3 @@ translation_of: Web/JavaScript <dt><a href="https://jsfiddle.net/">JSFiddle</a></dt> <dd>編輯 JavaScript、CSS、HTML 並取得及時結果。可以使用外部資源和與在線上與你的夥伴協作。</dd> </dl> -</div> -</div> diff --git a/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.html b/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.html index 744f6d9575..cf6d52ebd5 100644 --- a/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.html +++ b/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.html @@ -19,8 +19,8 @@ translation_of: Web/JavaScript/Inheritance_and_the_prototype_chain <p>JavaScript 物件是一「包」動態的屬性(也就是<strong>它自己</strong>的屬性)並擁有一個原型物件的鏈結,當物件試圖存取一個物件的屬性時,其不僅會尋找該物件,也會尋找該物件的原型、原型的原型……直到找到相符合的屬性,或是到達原型鏈的尾端。</p> -<div class="note"> -<p>遵照 ECMAScript 標準的 <code>someObject.[[Prototype]]</code> 標記,用於指派 <code>someObject</code> 的原型。從 ECMAScript 2015 開始, <code>[[Prototype]]</code> 使用 {{jsxref("Object.getPrototypeOf()")}} 與 {{jsxref("Object.setPrototypeOf()")}} 這兩個訪問器(accessors)訪問,等同於非標準,但各大瀏覽器已實做的 <code>__proto__</code> 屬性。</p> +<div class="notecard note"> +<p><strong>備註:</strong>遵照 ECMAScript 標準的 <code>someObject.[[Prototype]]</code> 標記,用於指派 <code>someObject</code> 的原型。從 ECMAScript 2015 開始, <code>[[Prototype]]</code> 使用 {{jsxref("Object.getPrototypeOf()")}} 與 {{jsxref("Object.setPrototypeOf()")}} 這兩個訪問器(accessors)訪問,等同於非標準,但各大瀏覽器已實做的 <code>__proto__</code> 屬性。</p> <p>不要把 <code>someObject.[[Prototype]]</code> 與函式屬性 <code><em>func</em>.prototype</code> 混淆了。它在函式被用作建構子的時候,指定 <code>[[Prototype]]</code> 要分派到所有由給定函式建立的物件實例(instance)。<code><strong>Object.prototype</strong></code> 屬性代表了原型屬性 {{jsxref("Object")}}。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/classes/constructor/index.html b/files/zh-tw/web/javascript/reference/classes/constructor/index.html index 2d349f8b4e..11ff5315b1 100644 --- a/files/zh-tw/web/javascript/reference/classes/constructor/index.html +++ b/files/zh-tw/web/javascript/reference/classes/constructor/index.html @@ -55,97 +55,11 @@ translation_of: Web/JavaScript/Reference/Classes/constructor <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('ES2015', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</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>功能</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>預設的建構子</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>功能</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - <tr> - <td>預設的建構子</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile(45)}}</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/classes/index.html b/files/zh-tw/web/javascript/reference/classes/index.html index 06ea8d5719..6b49150746 100644 --- a/files/zh-tw/web/javascript/reference/classes/index.html +++ b/files/zh-tw/web/javascript/reference/classes/index.html @@ -279,76 +279,11 @@ l.speak(); <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('ES6', '#sec-class-definitions', 'Class definitions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</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>Edge</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome(42.0)}}[1]<br> - {{CompatChrome(49.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>13</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatSafari(9.0)}}</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 Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>9</td> - <td>{{CompatChrome(42.0)}}[1]<br> - {{CompatChrome(49.0)}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/classes/static/index.html b/files/zh-tw/web/javascript/reference/classes/static/index.html index 77faa35833..de1ab29004 100644 --- a/files/zh-tw/web/javascript/reference/classes/static/index.html +++ b/files/zh-tw/web/javascript/reference/classes/static/index.html @@ -42,77 +42,11 @@ console.log(tp.triple()); // 'tp.triple is not a function'.</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('ES6', '#sec-class-definitions', 'Class definitions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-class-definitions', 'Class definitions')}}</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>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</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>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="你可能會需要看看">你可能會需要看看</h2> diff --git a/files/zh-tw/web/javascript/reference/errors/not_defined/index.html b/files/zh-tw/web/javascript/reference/errors/not_defined/index.html index fa79033977..8ce779db84 100644 --- a/files/zh-tw/web/javascript/reference/errors/not_defined/index.html +++ b/files/zh-tw/web/javascript/reference/errors/not_defined/index.html @@ -18,8 +18,8 @@ translation_of: Web/JavaScript/Reference/Errors/Not_defined <p>有個地方參照到不存在的變數了。這個變數需要宣告、或確定在目前腳本、或在 {{Glossary("scope")}} 裡可用。</p> -<div class="note"> -<p><strong>注意:</strong>如果要使用函式庫(例如 jQuery)的話,請確定在你使用諸如 $ 這樣的函式庫變數前,就已載入完畢。把載入函式庫的 {{HTMLElement("script")}} 標籤,放在你使用的程式碼之前。 +<div class="notecard note"> +<p><strong>備註:</strong>如果要使用函式庫(例如 jQuery)的話,請確定在你使用諸如 $ 這樣的函式庫變數前,就已載入完畢。把載入函式庫的 {{HTMLElement("script")}} 標籤,放在你使用的程式碼之前。 </p> </div> diff --git a/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html b/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html index fe8b1dcda3..fa0a7fe9ab 100644 --- a/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html +++ b/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Functions/arguments/callee <p><code>callee</code> is a property of the <code>arguments</code> object. It can be used to refer to the currently executing function inside the function body of that function. This is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous functions").</p> -<div class="warning"><strong>Warning:</strong> The 5th edition of ECMAScript (ES5) forbids use of <code>arguments.callee()</code> in <a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode">strict mode</a>. Avoid using <code>arguments.callee()</code> by either giving function expressions a name or use a function declaration where a function must call itself.</div> +<div class="notecard warning"><p><strong>Warning:</strong> The 5th edition of ECMAScript (ES5) forbids use of <code>arguments.callee()</code> in <a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode">strict mode</a>. Avoid using <code>arguments.callee()</code> by either giving function expressions a name or use a function declaration where a function must call itself.</p></div> <h3 id="Why_was_arguments.callee_removed_from_ES5_strict_mode">Why was <code>arguments.callee</code> removed from ES5 strict mode?</h3> @@ -108,87 +108,11 @@ john();</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('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.2</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-10.6', 'Arguments Object')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</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/functions/arguments/index.html b/files/zh-tw/web/javascript/reference/functions/arguments/index.html index ddccefae10..3a670e1f3c 100644 --- a/files/zh-tw/web/javascript/reference/functions/arguments/index.html +++ b/files/zh-tw/web/javascript/reference/functions/arguments/index.html @@ -20,12 +20,12 @@ translation_of: Web/JavaScript/Reference/Functions/arguments <h2 id="描述">描述</h2> -<div class="blockIndicator note"> -<p>Note: 如果你有在使用 ES6 語法,建議參考<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘參數</a>。</p> +<div class="notecard note"> +<p><strong>備註:</strong>如果你有在使用 ES6 語法,建議參考<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘參數</a>。</p> </div> -<div class="blockIndicator note"> -<p>Note: 「類陣列 (Array-like)」 的意思是 <code>arguments</code> 一樣擁有 <code>length</code>這項屬性,以及從 0 開始的索引,但是它沒有陣列內建的方法像是 <code>forEach()</code> ,或是 <code>map()</code> 。</p> +<div class="notecard note"> +<p><strong>備註:</strong>「類陣列 (Array-like)」 的意思是 <code>arguments</code> 一樣擁有 <code>length</code>這項屬性,以及從 0 開始的索引,但是它沒有陣列內建的方法像是 <code>forEach()</code> ,或是 <code>map()</code> 。</p> </div> <p>The <code>arguments</code> object is a local variable available within all (non-arrow) functions. You can refer to a function's arguments within the function by using the <code>arguments</code> object. This object contains an entry for each argument passed to the function, the first entry's index starting at 0.</p> @@ -52,8 +52,8 @@ var args = [].slice.call(arguments); const args = Array.from(arguments); </pre> -<div class="warning"> -<p class="brush: js">Using slice on arguments prevents optimizations in some JavaScript engines (V8 for example - <a href="https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments">more information</a>). If you care for them, try constructing a new array by iterating through the arguments object instead. An alternative would be to use the despised <code>Array</code> constructor as a function:</p> +<div class="notecard warning"> +<p><strong>警告:</strong>Using slice on arguments prevents optimizations in some JavaScript engines (V8 for example - <a href="https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments">more information</a>). If you care for them, try constructing a new array by iterating through the arguments object instead. An alternative would be to use the despised <code>Array</code> constructor as a function:</p> <pre class="brush: js">var args = (arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments));</pre> </div> diff --git a/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html b/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html index 1f37ee85c0..73bc901464 100644 --- a/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html +++ b/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html @@ -175,115 +175,11 @@ f(); // 6</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('ES2015', '#sec-function-definitions', 'Function Definitions')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function-definitions', 'Function Definitions')}}</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(49)}}</td> - <td>{{CompatGeckoDesktop("15.0")}}</td> - <td>Edge</td> - <td>{{CompatNo}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - <tr> - <td>Parameters without defaults after default parameters</td> - <td>{{CompatChrome(49)}}</td> - <td>{{CompatGeckoDesktop("26.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatSafari(10)}}</td> - </tr> - <tr> - <td>Destructured parameter with default value assignment</td> - <td>{{CompatChrome(49)}}</td> - <td>{{CompatGeckoDesktop("41.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>功能特徵</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(49)}}</td> - <td>{{CompatGeckoMobile("15.0")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(49)}}</td> - </tr> - <tr> - <td>Parameters without defaults after default parameters</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(49)}}</td> - <td>{{CompatGeckoMobile("26.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(49)}}</td> - </tr> - <tr> - <td>Destructured parameter with default value assignment</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatGeckoMobile("41.0")}}</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/functions/index.html b/files/zh-tw/web/javascript/reference/functions/index.html index 0d64fa570a..464a1f311e 100644 --- a/files/zh-tw/web/javascript/reference/functions/index.html +++ b/files/zh-tw/web/javascript/reference/functions/index.html @@ -100,7 +100,7 @@ function myFunc(theObject) { <h3 id="The_generator_function_declaration_(function*_statement)">The generator function declaration (<code>function*</code> statement)</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Generator function are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> @@ -122,7 +122,7 @@ function myFunc(theObject) { <h3 id="The_generator_function_expression_(function*_expression)">The generator function expression (<code>function*</code> expression)</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Generator function are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> @@ -145,7 +145,7 @@ function myFunc(theObject) { <h3 id="箭頭函式_The_arrow_function_expression_(>)">箭頭函式 The arrow function expression (=>)</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Arrow function expressions are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> @@ -167,7 +167,7 @@ param => expression <h3 id="The_Function_constructor">The <code>Function</code> constructor</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Using the <code>Function</code> constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.</p> </div> @@ -187,15 +187,15 @@ param => expression <h3 id="The_GeneratorFunction_constructor">The <code>GeneratorFunction</code> constructor</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Arrow function expressions are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> <code>GeneratorFunction</code> is not a global object, but could be obtained from generator function instance (see {{jsxref("GeneratorFunction")}} for more detail).</p> </div> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Using the <code>GeneratorFunction</code> constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.</p> </div> @@ -215,7 +215,7 @@ param => expression <h2 id="Function_parameters">Function parameters</h2> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> Default and rest parameters are <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> @@ -255,7 +255,7 @@ param => expression <h3 id="Method_definition_syntax">Method definition syntax</h3> -<div class="note"> +<div class="notecard note"> <p><strong>Note:</strong> <em>Method definitions are experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p> </div> @@ -453,126 +453,11 @@ result = padZeros(5,4); // returns "0005" <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>ECMAScript 1st Edition.</td> - <td>Standard</td> - <td>Initial definition. Implemented in JavaScript 1.0</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-13', 'Function Definition')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function-definitions', 'Function definitions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>New: Arrow functions, Generator functions, default parameters, rest parameters</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#', 'function*')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-arrow-function-definitions', 'Arrow Function Definitions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="Browser_compatibility">Browser compatibility</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> - <tr> - <td>Generator function</td> - <td>39</td> - <td>{{CompatGeckoDesktop("26.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>26</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Arrow function</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoDesktop("22.0")}}</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>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - <tr> - <td>Generator function</td> - <td>{{CompatUnknown}}</td> - <td>39</td> - <td>{{CompatGeckoMobile("26.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>26</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Arrow function</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile("22.0")}}</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/functions/method_definitions/index.html b/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html index 15aeef0f00..b56c884503 100644 --- a/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html +++ b/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html @@ -69,7 +69,7 @@ translation_of: Web/JavaScript/Reference/Functions/Method_definitions </li> </ul> -<pre class="brush: js;highlight[12]">// Using a named property +<pre class="brush: js">// Using a named property var obj2 = { g: function* () { var index = 0; @@ -95,7 +95,7 @@ console.log(it.next().value); // 1</pre> <p>{{jsxref("Statements/async_function", "Async 方法", "", 1)}} 也可以透過簡短語法定義。</p> -<pre class="brush: js;highlight[12]">// Using a named property +<pre class="brush: js">// Using a named property var obj3 = { f: async function () { await some_promise; @@ -150,7 +150,7 @@ new obj.g; // TypeError: obj.g is not a constructor (changed in ES2016) <h3 id="Simple_test_case">Simple test case</h3> -<pre class="brush: js;highlight[3]">var obj = { +<pre class="brush: js">var obj = { a: 'foo', b() { return this.a; } }; @@ -161,7 +161,7 @@ console.log(obj.b()); // "foo" <p>The shorthand syntax also supports computed property names.</p> -<pre class="brush: js;highlight[4]">var bar = { +<pre class="brush: js">var bar = { foo0: function() { return 0; }, foo1() { return 1; }, ['foo' + 2]() { return 2; } 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> diff --git a/files/zh-tw/web/javascript/reference/index.html b/files/zh-tw/web/javascript/reference/index.html index a4de78261c..25a68dc221 100644 --- a/files/zh-tw/web/javascript/reference/index.html +++ b/files/zh-tw/web/javascript/reference/index.html @@ -14,270 +14,336 @@ translation_of: Web/JavaScript/Reference <p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects">JavaScript 標準內建物件</a> 以及其方法與屬性。</p> -<ul class="card-grid"> - <li>數值屬性 - - <p>{{JSxRef("Infinity")}}<br> - {{JSxRef("NaN")}}<br> - {{JSxRef("undefined")}}<br> - {{JSxRef("globalThis")}}</p> - </li> - <li>函數屬性 - <p>{{JSxRef("Global_Objects/eval", "eval()")}}<br> - {{JSxRef("Global_Objects/isFinite", "isFinite()")}}<br> - {{JSxRef("Global_Objects/isNaN", "isNaN()")}}<br> - {{JSxRef("Global_Objects/parseFloat", "parseFloat()")}}<br> - {{JSxRef("Global_Objects/parseInt", "parseInt()")}}<br> - {{JSxRef("Global_Objects/decodeURI", "decodeURI()")}}<br> - {{JSxRef("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}<br> - {{JSxRef("Global_Objects/encodeURI", "encodeURI()")}}<br> - {{JSxRef("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}</p> - </li> - <li>基礎物件 - <p>{{JSxRef("Object")}}<br> - {{JSxRef("Function")}}<br> - {{JSxRef("Boolean")}}<br> - {{JSxRef("Symbol")}}</p> - </li> - <li>Error objects - <p>{{JSxRef("Error")}}<br> - {{JSxRef("AggregateError")}}<br> - {{JSxRef("EvalError")}}<br> - {{JSxRef("InternalError")}}<br> - {{JSxRef("RangeError")}}<br> - {{JSxRef("ReferenceError")}}<br> - {{JSxRef("SyntaxError")}}<br> - {{JSxRef("TypeError")}}<br> - {{JSxRef("URIError")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>數字與日期 - - <p>{{JSxRef("Number")}}<br> - {{JSxRef("BigInt")}}<br> - {{JSxRef("Math")}}<br> - {{JSxRef("Date")}}</p> - </li> - <li>文字處理 - <p>{{JSxRef("String")}}<br> - {{JSxRef("RegExp")}}</p> - </li> - <li>具索引的集合<a href="/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates#Numbers"> </a>{{JSxRef("Array")}}<br> - {{JSxRef("Int8Array")}}<br> - {{JSxRef("Uint8Array")}}<br> - {{JSxRef("Uint8ClampedArray")}}<br> - {{JSxRef("Int16Array")}}<br> - {{JSxRef("Uint16Array")}}<br> - {{JSxRef("Int32Array")}}<br> - {{JSxRef("Uint32Array")}}<br> - {{JSxRef("Float32Array")}}<br> - {{JSxRef("Float64Array")}}<br> - {{JSxRef("BigInt64Array")}}<br> - {{JSxRef("BigUint64Array")}}</li> - <li>具鍵值的集合 - <p>{{JSxRef("Map")}}<br> - {{JSxRef("Set")}}<br> - {{JSxRef("WeakMap")}}<br> - {{JSxRef("WeakSet")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>結構化資料 - - <p>{{JSxRef("ArrayBuffer")}}<br> - {{JSxRef("SharedArrayBuffer")}}<br> - {{JSxRef("Atomics")}}<br> - {{JSxRef("DataView")}}<br> - {{JSxRef("JSON")}}</p> - </li> - <li>控制抽象化物件 - <p>{{JSxRef("Promise")}}<br> - {{JSxRef("Generator")}}<br> - {{JSxRef("GeneratorFunction")}}<br> - {{JSxRef("AsyncFunction")}}</p> - </li> - <li>Reflection - <p>{{JSxRef("Reflect")}}<br> - {{JSxRef("Proxy")}}</p> - </li> - <li>國際化 - <p>{{JSxRef("Intl")}}<br> - {{JSxRef("Global_Objects/Collator", "Intl.Collator")}}<br> - {{JSxRef("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}<br> - {{JSxRef("Global_Objects/ListFormat", "Intl.ListFormat")}}<br> - {{JSxRef("Global_Objects/NumberFormat", "Intl.NumberFormat")}}<br> - {{JSxRef("Global_Objects/PluralRules", "Intl.PluralRules")}}<br> - {{JSxRef("Global_Objects/RelativeTimeFormat", "Intl.RelativeTimeFormat")}}<br> - {{JSxRef("Global_Objects/Locale", "Intl.Locale")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>WebAssembly - - <p>{{JSxRef("WebAssembly")}}<br> - {{JSxRef("WebAssembly.Module")}}<br> - {{JSxRef("WebAssembly.Instance")}}<br> - {{JSxRef("WebAssembly.Memory")}}<br> - {{JSxRef("WebAssembly.Table")}}<br> - {{JSxRef("WebAssembly.CompileError")}}<br> - {{JSxRef("WebAssembly.LinkError")}}<br> - {{JSxRef("WebAssembly.RuntimeError")}}</p> - </li> +<h3>數值屬性</h3> + +<ul> + <li>{{JSxRef("Infinity")}}</li> + <li>{{JSxRef("NaN")}}</li> + <li>{{JSxRef("undefined")}}</li> + <li>{{JSxRef("globalThis")}}</li> +</ul> + +<h3>函數屬性</h3> + +<ul> + <li>{{JSxRef("Global_Objects/eval", "eval()")}}</li> + <li>{{JSxRef("Global_Objects/isFinite", "isFinite()")}}</li> + <li>{{JSxRef("Global_Objects/isNaN", "isNaN()")}}</li> + <li>{{JSxRef("Global_Objects/parseFloat", "parseFloat()")}}</li> + <li>{{JSxRef("Global_Objects/parseInt", "parseInt()")}}</li> + <li>{{JSxRef("Global_Objects/decodeURI", "decodeURI()")}}</li> + <li>{{JSxRef("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}</li> + <li>{{JSxRef("Global_Objects/encodeURI", "encodeURI()")}}</li> + <li>{{JSxRef("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}</li> +</ul> + +<h3>基礎物件</h3> + +<ul> + <li>{{JSxRef("Object")}}</li> + <li>{{JSxRef("Function")}}</li> + <li>{{JSxRef("Boolean")}}</li> + <li>{{JSxRef("Symbol")}}</li> +</ul> + +<h3>Error</h3> + +<ul> + <li>{{JSxRef("Error")}}</li> + <li>{{JSxRef("AggregateError")}}</li> + <li>{{JSxRef("EvalError")}}</li> + <li>{{JSxRef("InternalError")}}</li> + <li>{{JSxRef("RangeError")}}</li> + <li>{{JSxRef("ReferenceError")}}</li> + <li>{{JSxRef("SyntaxError")}}</li> + <li>{{JSxRef("TypeError")}}</li> + <li>{{JSxRef("URIError")}}</li> +</ul> + +<h3>數字與日期</h3> + +<ul> + <li>{{JSxRef("Number")}}</li> + <li>{{JSxRef("BigInt")}}</li> + <li>{{JSxRef("Math")}}</li> + <li>{{JSxRef("Date")}}</li> +</ul> + +<h3>文字處理</h3> + +<ul> + <li>{{JSxRef("String")}}</li> + <li>{{JSxRef("RegExp")}}</li> +</ul> + +<h3>具索引的集合</h3> + +<ul> + <li>{{JSxRef("Array")}}</li> + <li>{{JSxRef("Int8Array")}}</li> + <li>{{JSxRef("Uint8Array")}}</li> + <li>{{JSxRef("Uint8ClampedArray")}}</li> + <li>{{JSxRef("Int16Array")}}</li> + <li>{{JSxRef("Uint16Array")}}</li> + <li>{{JSxRef("Int32Array")}}</li> + <li>{{JSxRef("Uint32Array")}}</li> + <li>{{JSxRef("Float32Array")}}</li> + <li>{{JSxRef("Float64Array")}}</li> + <li>{{JSxRef("BigInt64Array")}}</li> + <li>{{JSxRef("BigUint64Array")}}</li> +</ul> + +<h3>具鍵值的集合</h3> + +<ul> + <li>{{JSxRef("Map")}}</li> + <li>{{JSxRef("Set")}}</li> + <li>{{JSxRef("WeakMap")}}</li> + <li>{{JSxRef("WeakSet")}}</li> +</ul> + +<h3>結構化資料</h3> + +<ul> + <li>{{JSxRef("ArrayBuffer")}}</li> + <li>{{JSxRef("SharedArrayBuffer")}}</li> + <li>{{JSxRef("Atomics")}}</li> + <li>{{JSxRef("DataView")}}</li> + <li>{{JSxRef("JSON")}}</li> +</ul> + +<h3>控制抽象化物件</h3> + +<ul> + <li>{{JSxRef("Promise")}}</li> + <li>{{JSxRef("Generator")}}</li> + <li>{{JSxRef("GeneratorFunction")}}</li> + <li>{{JSxRef("AsyncFunction")}}</li> +</ul> + +<h3>Reflection</h3> + +<ul> + <li>{{JSxRef("Reflect")}}</li> + <li>{{JSxRef("Proxy")}}</li> +</ul> + +<h3>國際化</h3> + +<ul> + <li>{{JSxRef("Intl")}}</li> + <li>{{JSxRef("Global_Objects/Collator", "Intl.Collator")}}</li> + <li>{{JSxRef("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}</li> + <li>{{JSxRef("Global_Objects/ListFormat", "Intl.ListFormat")}}</li> + <li>{{JSxRef("Global_Objects/NumberFormat", "Intl.NumberFormat")}}</li> + <li>{{JSxRef("Global_Objects/PluralRules", "Intl.PluralRules")}}</li> + <li>{{JSxRef("Global_Objects/RelativeTimeFormat", "Intl.RelativeTimeFormat")}}</li> + <li>{{JSxRef("Global_Objects/Locale", "Intl.Locale")}}</li> +</ul> + +<h3>WebAssembly</h3> + +<ul> + <li>{{JSxRef("WebAssembly")}}</li> + <li>{{JSxRef("WebAssembly.Module")}}</li> + <li>{{JSxRef("WebAssembly.Instance")}}</li> + <li>{{JSxRef("WebAssembly.Memory")}}</li> + <li>{{JSxRef("WebAssembly.Table")}}</li> + <li>{{JSxRef("WebAssembly.CompileError")}}</li> + <li>{{JSxRef("WebAssembly.LinkError")}}</li> + <li>{{JSxRef("WebAssembly.RuntimeError")}}</li> </ul> <h2 id="敘述句">敘述句</h2> <p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements">JavaScript 敘述句與宣告</a>。</p> -<ul class="card-grid"> - <li>流程控制{{jsxref("Statements/block", "Block")}}<br> - {{jsxref("Statements/break", "break")}}<br> - {{jsxref("Statements/continue", "continue")}}<br> - {{jsxref("Statements/Empty", "Empty")}}<br> - {{jsxref("Statements/if...else", "if...else")}}<br> - {{jsxref("Statements/switch", "switch")}}<br> - {{jsxref("Statements/throw", "throw")}}<br> - {{jsxref("Statements/try...catch", "try...catch")}}</li> - <li>宣告 - <p>{{jsxref("Statements/var", "var")}}<br> - {{jsxref("Statements/let", "let")}}<br> - {{jsxref("Statements/const", "const")}}</p> - </li> - <li>函數與類別 - <p>{{jsxref("Statements/function", "function")}}<br> - {{jsxref("Statements/function*", "function*")}}<br> - {{jsxref("Statements/async_function", "async function")}}<br> - {{jsxref("Statements/return", "return")}}<br> - {{jsxref("Statements/class", "class")}}</p> - </li> - <li>迭代 - <p>{{jsxref("Statements/do...while", "do...while")}}<br> - {{jsxref("Statements/for", "for")}}<br> - {{jsxref("Statements/for_each...in", "for each...in")}}<br> - {{jsxref("Statements/for...in", "for...in")}}<br> - {{jsxref("Statements/for...of", "for...of")}}<br> - {{jsxref("Statements/for-await...of", "for await...of")}}<br> - {{jsxref("Statements/while", "while")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>Other - - <p>{{jsxref("Statements/debugger", "debugger")}}<br> - {{jsxref("Statements/import", "import")}}<br> - {{jsxref("Statements/label", "label")}}<br> - {{jsxref("Statements/with", "with")}}</p> - </li> +<h3>流程控制</h3> + +<ul> + <li>{{jsxref("Statements/block", "Block")}}</li> + <li>{{jsxref("Statements/break", "break")}}</li> + <li>{{jsxref("Statements/continue", "continue")}}</li> + <li>{{jsxref("Statements/Empty", "Empty")}}</li> + <li>{{jsxref("Statements/if...else", "if...else")}}</li> + <li>{{jsxref("Statements/switch", "switch")}}</li> + <li>{{jsxref("Statements/throw", "throw")}}</li> + <li>{{jsxref("Statements/try...catch", "try...catch")}}</li> +</ul> + +<h3>宣告</h3> + +<ul> + <li>{{jsxref("Statements/var", "var")}}</li> + <li>{{jsxref("Statements/let", "let")}}</li> + <li>{{jsxref("Statements/const", "const")}}</li> +</ul> + +<h3>函數與類別</h3> + +<ul> + <li>{{jsxref("Statements/function", "function")}}</li> + <li>{{jsxref("Statements/function*", "function*")}}</li> + <li>{{jsxref("Statements/async_function", "async function")}}</li> + <li>{{jsxref("Statements/return", "return")}}</li> + <li>{{jsxref("Statements/class", "class")}}</li> +</ul> + +<h3>迭代</h3> + +<ul> + <li>{{jsxref("Statements/do...while", "do...while")}}</li> + <li>{{jsxref("Statements/for", "for")}}</li> + <li>{{jsxref("Statements/for_each...in", "for each...in")}}</li> + <li>{{jsxref("Statements/for...in", "for...in")}}</li> + <li>{{jsxref("Statements/for...of", "for...of")}}</li> + <li>{{jsxref("Statements/for-await...of", "for await...of")}}</li> + <li>{{jsxref("Statements/while", "while")}}</li> +</ul> + +<h3>Other</h3> + +<ul> + <li>{{jsxref("Statements/debugger", "debugger")}}</li> + <li>{{jsxref("Statements/import", "import")}}</li> + <li>{{jsxref("Statements/label", "label")}}</li> + <li>{{jsxref("Statements/with", "with")}}</li> </ul> <h2 id="表示法與運算子">表示法與運算子</h2> <p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators">JavaScript 表示法與運算子</a>。</p> -<div> -<ul class="card-grid"> - <li>主要運算式{{JSxRef("Operators/this", "this")}}<br> - {{JSxRef("Operators/function", "function")}}<br> - {{JSxRef("Operators/class", "class")}}<br> - {{JSxRef("Operators/function*", "function*")}}<br> - {{JSxRef("Operators/yield", "yield")}}<br> - {{JSxRef("Operators/yield*", "yield*")}}<br> - {{JSxRef("Operators/async_function", "async function")}}<br> - {{JSxRef("Operators/await", "await")}}<br> - {{JSxRef("Global_Objects/Array", "[]")}}<br> - {{JSxRef("Operators/Object_initializer", "{}")}}<br> - {{JSxRef("Global_Objects/RegExp", "/ab+c/i")}}<br> - {{JSxRef("Operators/Grouping", "( )")}}<br> - {{JSxRef("null")}}</li> - <li>左手邊運算式 - <p>{{JSxRef("Operators/Property_accessors", "Property accessors", "", 1)}}<br> - {{JSxRef("Operators/new", "new")}}<br> - {{JSxRef("Operators/new%2Etarget", "new.target")}}<br> - {{JSxRef("Operators/super", "super")}}<br> - {{JSxRef("Operators/Spread_syntax", "...obj")}}</p> - </li> - <li>遞增與遞減 - <p>{{JSxRef("Operators/Arithmetic_Operators", "A++", "#Increment")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "A--", "#Decrement")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "++A", "#Increment")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "--A", "#Decrement")}}</p> - </li> - <li>一元運算子 - <p>{{JSxRef("Operators/delete", "delete")}}<br> - {{JSxRef("Operators/void", "void")}}<br> - {{JSxRef("Operators/typeof", "typeof")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "+", "#Unary_plus")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "-", "#Unary_negation")}}<br> - {{JSxRef("Operators/Bitwise_Operators", "~", "#Bitwise_NOT")}}<br> - {{JSxRef("Operators/Logical_Operators", "!", "#Logical_NOT")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>算術運算子 - - <p>{{JSxRef("Operators/Arithmetic_Operators", "+", "#Addition")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "-", "#Subtraction")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "/", "#Division")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "*", "#Multiplication")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "%", "#Remainder")}}<br> - {{JSxRef("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}</p> - </li> - <li>關係運算子 - <p>{{JSxRef("Operators/in", "in")}}<br> - {{JSxRef("Operators/instanceof", "instanceof")}}<br> - {{JSxRef("Operators/Comparison_Operators", "<", "#Less_than_operator")}}<br> - {{JSxRef("Operators/Comparison_Operators", ">", "#Greater_than_operator")}}<br> - {{JSxRef("Operators/Comparison_Operators", "<=", "#Less_than_or_equal_operator")}}<br> - {{JSxRef("Operators/Comparison_Operators", ">=", "#Greater_than_or_equal_operator")}}</p> - </li> - <li>相等運算子 - <p>{{JSxRef("Operators/Comparison_Operators", "==", "#Equality")}}<br> - {{JSxRef("Operators/Comparison_Operators", "!=", "#Inequality")}}<br> - {{JSxRef("Operators/Comparison_Operators", "===", "#Identity")}}<br> - {{JSxRef("Operators/Comparison_Operators", "!==", "#Nonidentity")}}</p> - </li> - <li>位元移位運算子 - <p>{{JSxRef("Operators/Bitwise_Operators", "<<", "#Left_shift")}}<br> - {{JSxRef("Operators/Bitwise_Operators", ">>", "#Right_shift")}}<br> - {{JSxRef("Operators/Bitwise_Operators", ">>>", "#Unsigned_right_shift")}}</p> - </li> -</ul> - -<ul class="card-grid"> - <li>二元位元運算子{{JSxRef("Operators/Bitwise_Operators", "&", "#Bitwise_AND")}}<br> - {{JSxRef("Operators/Bitwise_Operators", "|", "#Bitwise_OR")}}<br> - {{JSxRef("Operators/Bitwise_Operators", "^", "#Bitwise_XOR")}}</li> - <li>二元邏輯運算子 - <p>{{JSxRef("Operators/Logical_Operators", "&&", "#Logical_AND")}}<br> - {{JSxRef("Operators/Logical_Operators", "||", "#Logical_OR")}}</p> - </li> - <li>條件(三元)運算子 - <p>{{JSxRef("Operators/Conditional_Operator", "(condition ? ifTrue : ifFalse)")}}</p> - </li> - <li>賦值運算子 - <p>{{JSxRef("Operators/Assignment_Operators", "=", "#Assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "*=", "#Multiplication_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "/=", "#Division_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "%=", "#Remainder_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "+=", "#Addition_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "-=", "#Subtraction_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "<<=", "#Left_shift_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", ">>=", "#Right_shift_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", ">>>=", "#Unsigned_right_shift_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "&=", "#Bitwise_AND_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "^=", "#Bitwise_XOR_assignment")}}<br> - {{JSxRef("Operators/Assignment_Operators", "|=", "#Bitwise_OR_assignment")}}<br> - {{JSxRef("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}}<br> - {{JSxRef("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}}</p> - </li> -</ul> -</div> +<h3>主要運算式</h3> + +<ul> + <li>{{JSxRef("Operators/this", "this")}}</li> + <li>{{JSxRef("Operators/function", "function")}}</li> + <li>{{JSxRef("Operators/class", "class")}}</li> + <li>{{JSxRef("Operators/function*", "function*")}}</li> + <li>{{JSxRef("Operators/yield", "yield")}}</li> + <li>{{JSxRef("Operators/yield*", "yield*")}}</li> + <li>{{JSxRef("Operators/async_function", "async function")}}</li> + <li>{{JSxRef("Operators/await", "await")}}</li> + <li>{{JSxRef("Global_Objects/Array", "[]")}}</li> + <li>{{JSxRef("Operators/Object_initializer", "{}")}}</li> + <li>{{JSxRef("Global_Objects/RegExp", "/ab+c/i")}}</li> + <li>{{JSxRef("Operators/Grouping", "( )")}}</li> + <li>{{JSxRef("null")}}</li> +</ul> + +<h3>左手邊運算式</h3> + +<ul> + <li>{{JSxRef("Operators/Property_accessors", "Property accessors", "", 1)}}</li> + <li>{{JSxRef("Operators/new", "new")}}</li> + <li>{{JSxRef("Operators/new%2Etarget", "new.target")}}</li> + <li>{{JSxRef("Operators/super", "super")}}</li> + <li>{{JSxRef("Operators/Spread_syntax", "...obj")}}</p></li> +</ul> + +<h3>遞增與遞減</h3> + +<ul> + <li>{{JSxRef("Operators/Arithmetic_Operators", "A++", "#Increment")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "A--", "#Decrement")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "++A", "#Increment")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "--A", "#Decrement")}}</li> +</ul> + +<h3>一元運算子</h3> + +<ul> + <li>{{JSxRef("Operators/delete", "delete")}}</li> + <li>{{JSxRef("Operators/void", "void")}}</li> + <li>{{JSxRef("Operators/typeof", "typeof")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "+", "#Unary_plus")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "-", "#Unary_negation")}}</li> + <li>{{JSxRef("Operators/Bitwise_Operators", "~", "#Bitwise_NOT")}}</li> + <li>{{JSxRef("Operators/Logical_Operators", "!", "#Logical_NOT")}}</li> +</ul> + +<h3>算術運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Arithmetic_Operators", "+", "#Addition")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "-", "#Subtraction")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "/", "#Division")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "*", "#Multiplication")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "%", "#Remainder")}}</li> + <li>{{JSxRef("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}</li> +</ul> + +<h3>關係運算子</h3> + +<ul> + <li>{{JSxRef("Operators/in", "in")}}</li> + <li>{{JSxRef("Operators/instanceof", "instanceof")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", "<", "#Less_than_operator")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", ">", "#Greater_than_operator")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", "<=", "#Less_than_or_equal_operator")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", ">=", "#Greater_than_or_equal_operator")}}</li> +</ul> + +<h3>相等運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Comparison_Operators", "==", "#Equality")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", "!=", "#Inequality")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", "===", "#Identity")}}</li> + <li>{{JSxRef("Operators/Comparison_Operators", "!==", "#Nonidentity")}}</li> +</ul> + +<h3>位元移位運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Bitwise_Operators", "<<", "#Left_shift")}}</li> + <li>{{JSxRef("Operators/Bitwise_Operators", ">>", "#Right_shift")}}</li> + <li>{{JSxRef("Operators/Bitwise_Operators", ">>>", "#Unsigned_right_shift")}}</li> +</ul> + +<h3>二元位元運算子</h3> + +<ul> + <ul> + <li>{{JSxRef("Operators/Bitwise_Operators", "&", "#Bitwise_AND")}}</li> + <li>{{JSxRef("Operators/Bitwise_Operators", "|", "#Bitwise_OR")}}</li> + <li>{{JSxRef("Operators/Bitwise_Operators", "^", "#Bitwise_XOR")}}</li></li> + </ul> +</ul> + +<h3>二元邏輯運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Logical_Operators", "&&", "#Logical_AND")}}</li> + <li>{{JSxRef("Operators/Logical_Operators", "||", "#Logical_OR")}}</li> +</ul> + +<h3>條件(三元)運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Conditional_Operator", "(condition ? ifTrue : ifFalse)")}}</li> +</ul> + +<h3>賦值運算子</h3> + +<ul> + <li>{{JSxRef("Operators/Assignment_Operators", "=", "#Assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "*=", "#Multiplication_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "/=", "#Division_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "%=", "#Remainder_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "+=", "#Addition_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "-=", "#Subtraction_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "<<=", "#Left_shift_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", ">>=", "#Right_shift_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", ">>>=", "#Unsigned_right_shift_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "&=", "#Bitwise_AND_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "^=", "#Bitwise_XOR_assignment")}}</li> + <li>{{JSxRef("Operators/Assignment_Operators", "|=", "#Bitwise_OR_assignment")}}</li> + <li>{{JSxRef("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}}</li> + <li>{{JSxRef("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}}</li> +</ul> + <h2 id="函數">函數</h2> diff --git a/files/zh-tw/web/javascript/reference/iteration_protocols/index.html b/files/zh-tw/web/javascript/reference/iteration_protocols/index.html index 707da81524..8c360e0894 100644 --- a/files/zh-tw/web/javascript/reference/iteration_protocols/index.html +++ b/files/zh-tw/web/javascript/reference/iteration_protocols/index.html @@ -71,8 +71,8 @@ translation_of: Web/JavaScript/Reference/Iteration_protocols </tbody> </table> -<div class="note"> -<p>我們無法反射性的一眼看出一個特定的物件是否實作了迭代器協議,然而要建立一個同時滿足迭代器及可迭代協議的物件卻是相當容易(如下例所示)。範例的做法允許一個迭代器被各個預期其可迭代行為的語法所消費。因此很少有需要實作迭代器協議而沒有實作可迭代協議的情況。</p> +<div class="notecard note"> +<p><strong>備註:</strong>我們無法反射性的一眼看出一個特定的物件是否實作了迭代器協議,然而要建立一個同時滿足迭代器及可迭代協議的物件卻是相當容易(如下例所示)。範例的做法允許一個迭代器被各個預期其可迭代行為的語法所消費。因此很少有需要實作迭代器協議而沒有實作可迭代協議的情況。</p> <pre class="brush: js">var myIterator = { next: function() { diff --git a/files/zh-tw/web/javascript/reference/operators/await/index.html b/files/zh-tw/web/javascript/reference/operators/await/index.html index dd1121503f..dea65636a8 100644 --- a/files/zh-tw/web/javascript/reference/operators/await/index.html +++ b/files/zh-tw/web/javascript/reference/operators/await/index.html @@ -70,78 +70,11 @@ f3();</pre> <h2 id="規範">規範</h2> -<table class="standard-table"> - <thead> - <tr> - <th scope="col">規範</th> - <th scope="col">狀態</th> - <th scope="col">註解</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('ESDraft', '#sec-async-function-definitions', 'async functions')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td>ES2017中初始定義</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>Edge</th> - <th>Opera</th> - <th>Safari (WebKit)</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatChrome(55)}}</td> - <td>{{CompatGeckoDesktop("52.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatOpera(42)}}</td> - <td>10.1</td> - </tr> - </tbody> -</table> -</div> - -<div> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>基本支援</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile("52.0")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatOpera(42)}}</td> - <td>10.1</td> - <td>{{CompatChrome(55)}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="See_also">See also</h2> diff --git a/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html b/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html index e1c45ea5b0..f48dc17505 100644 --- a/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html +++ b/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html @@ -28,7 +28,7 @@ translation_of: Web/JavaScript/Reference/Operators/Comma_Operator <p>The following code prints the values of the diagonal elements in the array:</p> -<pre class="brush:js;highlight:[1]">for (var i = 0, j = 9; i <= 9; i++, j--) +<pre class="brush:js">for (var i = 0, j = 9; i <= 9; i++, j--) console.log("a[" + i + "][" + j + "] = " + a[i][j]);</pre> <p>Note that the comma in assignments such as the <code>var</code> statement may appear not to have the normal effect of comma operators because they don't exist within an expression. In the following example, <code>a</code> is set to the value of <code>b = 3</code> (which is 3), but the <code>c = 4</code> expression still evaluates and its result returned to console (i.e., 4). This is due to <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">operator precedence and associativity</a>.</p> @@ -56,87 +56,11 @@ console.log(x); // 6 (right-most) <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('ESDraft', '#sec-comma-operator', 'Comma operator')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-comma-operator', 'Comma operator')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-11.14', 'Comma operator')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES1', '#sec-11.14', 'Comma operator')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition</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>3.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>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/operators/destructuring_assignment/index.html b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html index 0cae43e2b5..c582226725 100644 --- a/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html +++ b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html @@ -200,8 +200,8 @@ console.log(q); // true ({a, b} = {a:1, b:2});</pre> -<div class="note"> -<p><strong>注意</strong>:當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 <code>( ... )</code> 。</p> +<div class="notecard note"> +<p><strong>備註:</strong>當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 <code>( ... )</code> 。</p> <p><code>{a, b} = {a: 1, b: 2}</code> 不是有效的獨立語法,因為左邊的 <code>{a, b}</code> 被視為程式碼區塊而非物件。</p> @@ -277,8 +277,8 @@ drawChart({ radius: 30 });</pre> -<div class="note"> -<p>在上述函式 <strong><code>drawChart</code></strong> 中,左方之解構式被指派到一個空物件: <code>{size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}</code> 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 <code><strong>drawChart()</strong></code> 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。</p> +<div class="notecard note"> +<p><strong>備註:</strong>在上述函式 <strong><code>drawChart</code></strong> 中,左方之解構式被指派到一個空物件: <code>{size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}</code> 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 <code><strong>drawChart()</strong></code> 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。</p> </div> <h3 id="巢狀物件或陣列的解構">巢狀物件或陣列的解構</h3> diff --git a/files/zh-tw/web/javascript/reference/operators/index.html b/files/zh-tw/web/javascript/reference/operators/index.html index 6d27e8d2a5..efaf3d991d 100644 --- a/files/zh-tw/web/javascript/reference/operators/index.html +++ b/files/zh-tw/web/javascript/reference/operators/index.html @@ -138,8 +138,8 @@ translation_of: Web/JavaScript/Reference/Operators <dd>大於等於運算子。</dd> </dl> -<div class="note"> -<p><strong>Note: =></strong> is not an operator, but the notation for <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a>.</p> +<div class="notecard note"> +<p><strong>Note:</strong> => is not an operator, but the notation for <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a>.</p> </div> <h3 id="相等運算子">相等運算子</h3> diff --git a/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html b/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html index 5ce80cd8e8..436aa0fdfe 100644 --- a/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html +++ b/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html @@ -248,178 +248,11 @@ assert(obj3.__proto__ === 17); <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-11.1.5', 'Object Initializer')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">getter</a> and <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a> added.</td> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-object-initializer', 'Object Initializer')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Shorthand method/property names and computed property names added.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-object-initializer', 'Object Initializer')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - <tr> - <td><a href="https://github.com/tc39/proposal-object-rest-spread">Rest/Spread Properties for ECMAScript </a></td> - <td>Draft</td> - <td>Stage 3 draft.</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(1.0)}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("1.0")}}</td> - <td>1</td> - <td>1</td> - <td>1</td> - </tr> - <tr> - <td>Computed property names</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("34")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>7.1</td> - </tr> - <tr> - <td>Shorthand property names</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("33")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>9</td> - </tr> - <tr> - <td>Shorthand method names</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoDesktop("34")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>9</td> - </tr> - <tr> - <td>Spread properties</td> - <td>{{CompatChrome(60)}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoDesktop("55")}}</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>Android Webview</th> - <th>Edge</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("1.0")}}</td> - <td>1</td> - <td>1</td> - <td>1</td> - <td>{{CompatChrome(1.0)}}</td> - </tr> - <tr> - <td>Computed property names</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("34")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>7.1</td> - <td>{{CompatNo}}</td> - </tr> - <tr> - <td>Shorthand property names</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("33")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>9</td> - <td>{{CompatNo}}</td> - </tr> - <tr> - <td>Shorthand method names</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatGeckoMobile("34")}}</td> - <td>{{CompatNo}}</td> - <td>34</td> - <td>9</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - <tr> - <td>Spread properties</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoMobile("55")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> diff --git a/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html b/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html index 0395059d09..2e3592d41a 100644 --- a/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html +++ b/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html @@ -33,7 +33,7 @@ translation_of: Web/JavaScript/Reference/Operators/Operator_Precedence <p>下方表格列出運算子的相依性,從高 (20) 到低 (1)。</p> -<table class="fullwidth-table"> +<table> <tbody> <tr> <th>優先性<br> diff --git a/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html index 715161eca9..7326405696 100644 --- a/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html +++ b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html @@ -61,8 +61,8 @@ let nestedProp = ((temp === null || temp === undefined) ? undefined : temp.secon <pre class="brush: js">let result = someInterface.customMethod?.();</pre> -<div class="blockIndicator note"> -<p><strong>注意:</strong> 假如物件有同樣的屬性名稱,而不是一個方法,使用 <code>?.</code> 將會抛出 {{JSxRef("TypeError")}} 錯誤(<code>x.y</code><code> 不是一個函數</code>.</p> +<div class="notecard note"> +<p><strong>備註:</strong>假如物件有同樣的屬性名稱,而不是一個方法,使用 <code>?.</code> 將會抛出 {{JSxRef("TypeError")}} 錯誤(<code>x.y</code><code> 不是一個函數</code>.</p> </div> <h4 id="處理回呼函式或事件處理器">處理回呼函式或事件處理器</h4> diff --git a/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html b/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html index 6b69748661..a9d0af6472 100644 --- a/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html +++ b/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html @@ -111,7 +111,7 @@ arr2.push(4); // arr remains unaffected </pre> -<div class="blockIndicator note"> +<div class="notecard note"> <p><strong>Note:</strong> Spread syntax effectively goes one level deep while copying an array. Therefore, it may be unsuitable for copying multidimensional arrays, as the following example shows. (The same is true with {{jsxref("Object.assign()")}} and spread syntax.)</p> <pre class="brush: js example-bad">const a = [[1], [2], [3]]; @@ -165,7 +165,7 @@ arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] </pre> -<div class="blockIndicator note"> +<div class="notecard note"> <p><strong>Note:</strong> Unlike <code>unshift()</code>, this creates a new <code>arr1</code>, and does not modify the original <code>arr1</code> array in-place.</p> </div> diff --git a/files/zh-tw/web/javascript/reference/operators/this/index.html b/files/zh-tw/web/javascript/reference/operators/this/index.html index 9c99fb42f2..1dd3d43d4e 100644 --- a/files/zh-tw/web/javascript/reference/operators/this/index.html +++ b/files/zh-tw/web/javascript/reference/operators/this/index.html @@ -65,8 +65,8 @@ f2() === undefined; //true</pre> <p>所以在嚴格模式下,如果 <code>this</code> 沒有定義到執行環境內,其預設值就會是 <code>undefined</code>。</p> -<div class="note"> -<p>在第二個例子裡面,<code>this</code> 應為 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/undefined"><code>undefined</code></a>,因為 <code>f2</code> 是直接被呼叫,而不是在其為某個物件的方法或屬性的情況下(例如 <code>window.f2()</code>)被直接呼叫。某些瀏覽器首次支援<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="Strict mode">嚴格模式</a>時沒導入這個特徵,它們會因此錯誤的回傳 <code>window</code> 物件。</p> +<div class="notecard note"> +<p><strong>備註:</strong>在第二個例子裡面,<code>this</code> 應為 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/undefined"><code>undefined</code></a>,因為 <code>f2</code> 是直接被呼叫,而不是在其為某個物件的方法或屬性的情況下(例如 <code>window.f2()</code>)被直接呼叫。某些瀏覽器首次支援<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="Strict mode">嚴格模式</a>時沒導入這個特徵,它們會因此錯誤的回傳 <code>window</code> 物件。</p> </div> <p>要從某個語境訪問另一個 <code>this</code> 語境的值,請使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/call">call</a> 或 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/apply">apply</a>:</p> @@ -138,8 +138,8 @@ console.log(o.f(), o.g(), o.h()); // 37, azerty, azerty</code> var foo = (() => this); console.log(foo() === globalObject); // true</pre> -<div class="note"> -<p>註:如果這參數被傳遞給箭頭函式的 call, bind, apply 調用,該參數會被忽略。你仍然可以將參數預先調用到call,但第一個參數(thisArg)必須設置為空。</p> +<div class="notecard note"> +<p><strong>備註:</strong>如果這參數被傳遞給箭頭函式的 call, bind, apply 調用,該參數會被忽略。你仍然可以將參數預先調用到call,但第一個參數(thisArg)必須設置為空。</p> </div> <pre class="brush: js">// 作為物件的方法呼叫 @@ -253,8 +253,8 @@ console.log(o.average, o.sum); // logs 2, 6 <p>若函式以建構子的身份呼叫(使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/new">new</a></code> 關鍵字) <code>this</code> 會和被建構的新物件綁定。</p> -<div class="note"> -<p>建構子預設透過 <code>this</code> 回傳該物件的參照,但它其實能回傳其他物件。如果回傳值不是物件的話,就會回傳 <code>this</code> 這個物件。</p> +<div class="notecard note"> +<p><strong>備註:</strong>建構子預設透過 <code>this</code> 回傳該物件的參照,但它其實能回傳其他物件。如果回傳值不是物件的話,就會回傳 <code>this</code> 這個物件。</p> </div> <pre class="brush:js">/* diff --git a/files/zh-tw/web/javascript/reference/operators/typeof/index.html b/files/zh-tw/web/javascript/reference/operators/typeof/index.html index e7f4c388e8..f9bb266a74 100644 --- a/files/zh-tw/web/javascript/reference/operators/typeof/index.html +++ b/files/zh-tw/web/javascript/reference/operators/typeof/index.html @@ -144,8 +144,8 @@ typeof Math.sin === 'function'; <p>這個問題已計畫<a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null">在下一版 ECMAScript 予以修正</a> (會以 opt-in 方式提供). 屆時它將會做出如 <code>typeof null === 'null'</code> 的正確回傳結果。</p> -<div class="note"> -<p>註: 此修正計畫已被拒絕</p> +<div class="notecard note"> +<p><strong>備註:</strong>此修正計畫已被拒絕</p> </div> <h3 id="正規表示式_(Regular_expressions)">正規表示式 (Regular expressions)</h3> @@ -162,8 +162,8 @@ typeof /s/ === 'object'; // Firefox 5+ ... // 符合 ECMAScript 5.1 <p>在 IE 6, 7 和 8, <code>typeof alert === 'object'</code></p> -<div class="note"> -<p>註: 這並不怪異。這是實情。在許多較舊的 IE 中, 主機端物件的確是物件, 而非函數</p> +<div class="notecard note"> +<p><strong>備註:</strong>這並不怪異。這是實情。在許多較舊的 IE 中, 主機端物件的確是物件, 而非函數</p> </div> <h2 id="規格">規格</h2> diff --git a/files/zh-tw/web/javascript/reference/statements/async_function/index.html b/files/zh-tw/web/javascript/reference/statements/async_function/index.html index 1111e54da6..7faf5dcfef 100644 --- a/files/zh-tw/web/javascript/reference/statements/async_function/index.html +++ b/files/zh-tw/web/javascript/reference/statements/async_function/index.html @@ -45,8 +45,8 @@ translation_of: Web/JavaScript/Reference/Statements/async_function <p>async 函式內部可以使用 {{jsxref("Operators/await", "await")}} 表達式,它會暫停此 async 函式的執行,並且等待傳遞至表達式的 Promise 的解析,解析完之後會回傳解析值,並繼續此 async 函式的執行。</p> -<div class="note"> -<p><code>async/await</code> 函式的目的在於簡化同步操作 promise 的表現,以及對多個 <code>Promise</code> 物件執行某些操作。就像 <code>Promise 類似於具結構性的回呼函式,同樣地,async/await 好比將 generator 與 promise 組合起來。</code></p> +<div class="notecard note"> +<p><strong>備註:</strong><code>async/await</code> 函式的目的在於簡化同步操作 promise 的表現,以及對多個 <code>Promise</code> 物件執行某些操作。就像 <code>Promise 類似於具結構性的回呼函式,同樣地,async/await 好比將 generator 與 promise 組合起來。</code></p> </div> <h2 id="範例">範例</h2> @@ -84,8 +84,8 @@ add2(10).then(v => { }); </pre> -<div class="warning"> -<h4 id="不要誤解_Promise.all_的_await">不要誤解 <code>Promise.all</code> 的 <code>await</code></h4> +<div class="notecard warning"> +<p><strong>警告:</strong>不要誤解 <code>Promise.all</code> 的 <code>await</code></p> <p>在 <code>add1</code> 裡,該執行為了第一個 <code>await</code> 而暫停了兩秒,接著為了第二個 <code>await</code> 又暫停了兩秒。在第一個計時器(timer)被觸發前,第二個計時器並不會被建立。而在 <code>add2</code> 裡,兩個計時器都被建立起來、也都執行 <code>await</code> 過了。這把它帶往了 resolve 所的 2 秒暫停、而不是 4 秒暫停。然而這兩個 <code>await</code> 呼叫都在連續運行,而非平行運行。<code>await</code> <strong>並不是</strong> <code>Promise.all</code> 的自動程式。如果你想讓兩個、甚至兩個以上的 <code>await</code> promises 同時執行(in parallel),你必須使用 <code>Promise.all</code>.</p> </div> diff --git a/files/zh-tw/web/javascript/reference/statements/block/index.html b/files/zh-tw/web/javascript/reference/statements/block/index.html index 0e1d2ce662..a62ff2583e 100644 --- a/files/zh-tw/web/javascript/reference/statements/block/index.html +++ b/files/zh-tw/web/javascript/reference/statements/block/index.html @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Statements/block <table class="standard-table"> <tbody> <tr> - <td class="header" colspan="2">陳述句</td> + <th colspan="2">陳述句</th> </tr> <tr> <td>Implemented in</td> @@ -63,7 +63,7 @@ alert(x); // outputs 2 <p>當使用<code>let</code>或是<code>const</code>進行宣告時,其存取範圍是只有本身定義的區塊中。</p> -<pre class="brush: js line-numbers language-js">let x = 1; +<pre class="brush: js">let x = 1; { let x = 2; } diff --git a/files/zh-tw/web/javascript/reference/statements/break/index.html b/files/zh-tw/web/javascript/reference/statements/break/index.html index ff72f9d25b..b5fa73113e 100644 --- a/files/zh-tw/web/javascript/reference/statements/break/index.html +++ b/files/zh-tw/web/javascript/reference/statements/break/index.html @@ -25,13 +25,13 @@ translation_of: Web/JavaScript/Reference/Statements/break <h2 id="說明">說明</h2> -<p>中斷陳述 <code>break</code> 可加上標籤 (label) 參數,使其跳出被標籤的陳述語句。此中斷陳述 <code>break</code> 必須被包含在被標籤的陳述語句中。被標籤的陳述語句可被添加於任一個區塊 (<a class="internal" href="/en-US/docs/JavaScript/Reference/Statements/block" title="JavaScript/Reference/Statements/Block">block</a>) 前,而非限定在迴圈陳述。</p> +<p>中斷陳述 <code>break</code> 可加上標籤 (label) 參數,使其跳出被標籤的陳述語句。此中斷陳述 <code>break</code> 必須被包含在被標籤的陳述語句中。被標籤的陳述語句可被添加於任一個區塊 (<a href="/en-US/docs/JavaScript/Reference/Statements/block" title="JavaScript/Reference/Statements/Block">block</a>) 前,而非限定在迴圈陳述。</p> <h2 id="範例">範例</h2> <p>下面函式包含一個中斷陳述 <code>break</code> ,當 <code>i</code> 值為 3 時,中斷 <code>while</code> 迴圈,並回傳 <code>3 * x</code> 。</p> -<pre class="brush:js;highlight:[6];">function testBreak(x) { +<pre class="brush:js">function testBreak(x) { var i = 0; while (i < 6) { @@ -46,7 +46,7 @@ translation_of: Web/JavaScript/Reference/Statements/break <p>The following code uses <code>break</code> statements with labeled blocks. A <code>break</code> statement must be nested within any label it references. Notice that <code>inner_block</code> is nested within <code>outer_block</code>.</p> -<pre class="brush:js;highlight:[1,2,4];">outer_block: { +<pre class="brush:js">outer_block: { inner_block: { console.log('1'); break outer_block; // breaks out of both inner_block and outer_block @@ -58,7 +58,7 @@ translation_of: Web/JavaScript/Reference/Statements/break <p>The following code also uses <code>break</code> statements with labeled blocks but generates a Syntax Error because its <code>break</code> statement is within <code>block_1</code> but references <code>block_2</code>. A <code>break</code> statement must always be nested within any label it references.</p> -<pre class="brush:js;highlight:[1,3,6];">block_1: { +<pre class="brush:js">block_1: { console.log('1'); break block_2; // SyntaxError: label not found } diff --git a/files/zh-tw/web/javascript/reference/statements/debugger/index.html b/files/zh-tw/web/javascript/reference/statements/debugger/index.html index 79a65a398e..d5d1662cf4 100644 --- a/files/zh-tw/web/javascript/reference/statements/debugger/index.html +++ b/files/zh-tw/web/javascript/reference/statements/debugger/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Statements/debugger <p>呼叫除錯器時,程式會在 debugger 宣告處暫停執行。它有點像是程式碼的斷點。</p> -<p><a href="https://mdn.mozillademos.org/files/6963/Screen Shot 2014-02-07 at 9.14.35 AM.png"><img alt="Paused at a debugger statement." src="https://mdn.mozillademos.org/files/6963/Screen%20Shot%202014-02-07%20at%209.14.35%20AM.png" style="height: 371px; width: 700px;"></a></p> +<p><a href="https://mdn.mozillademos.org/files/6963/Screen Shot 2014-02-07 at 9.14.35 AM.png"><img alt="Paused at a debugger statement." src="https://mdn.mozillademos.org/files/6963/Screen%20Shot%202014-02-07%20at%209.14.35%20AM.png"></a></p> <h2 id="規範">規範</h2> diff --git a/files/zh-tw/web/javascript/reference/statements/for...in/index.html b/files/zh-tw/web/javascript/reference/statements/for...in/index.html index 92ab3aa5c0..727397cce0 100644 --- a/files/zh-tw/web/javascript/reference/statements/for...in/index.html +++ b/files/zh-tw/web/javascript/reference/statements/for...in/index.html @@ -47,12 +47,12 @@ translation_of: Web/JavaScript/Reference/Statements/for...in <p>A <code>for...in</code> loop iterates over the properties of an object in an arbitrary order (see the <a href="/en-US/docs/JavaScript/Reference/Operators/delete#Cross-browser_issues">delete operator</a> for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). If a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. A property that is deleted before it has been visited will not be visited later. Properties added to the object over which iteration is occurring may either be visited or omitted from iteration. In general it is best not to add, modify or remove properties from the object during iteration, other than the property currently being visited. There is no guarantee whether or not an added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted.</p> -<div class="note"> -<p>If you only want to consider properties attached to the object itself, and not its prototypes, use <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames">getOwnPropertyNames</a> or perform a <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty">hasOwnProperty</a> check (<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable">propertyIsEnumerable</a> can also be used). Alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method.</p> +<div class="notecard note"> +<p><strong>Note:</strong> If you only want to consider properties attached to the object itself, and not its prototypes, use <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames">getOwnPropertyNames</a> or perform a <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty">hasOwnProperty</a> check (<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable">propertyIsEnumerable</a> can also be used). Alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method.</p> </div> -<div class="note"> -<p><strong><code>for..in</code> 不應該用來迭代一個索引順序很重要的<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array">陣列</a>。</strong> 陣列索引只是以整數命名的可列舉屬性,其他方面等同於一般物件屬性。 無法擔保 <code>for...in</code> 以特定順序傳回索引,並且它將傳回全部可列舉屬性,包括非整數名的,以及繼承而來的可列舉屬性。</p> +<div class="notecard note"> +<p><strong>備註:</strong><strong><code>for..in</code> 不應該用來迭代一個索引順序很重要的<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array">陣列</a>。</strong> 陣列索引只是以整數命名的可列舉屬性,其他方面等同於一般物件屬性。 無法擔保 <code>for...in</code> 以特定順序傳回索引,並且它將傳回全部可列舉屬性,包括非整數名的,以及繼承而來的可列舉屬性。</p> <p>因為迭代的順序依賴於 JavaScript 引擎的實作,在不同引擎下,迭代一個陣列可能不是以一個一致的順序存取陣列元素。因此,當你迭代陣列,且該陣列的存取順序很重要時,最好是使用以數值索引的 <a href="/en-US/docs/JavaScript/Reference/Statements/for">for</a> 迴圈 (或 <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach">Array.forEach</a> 或非標準 <code><a href="/en-US/docs/JavaScript/Reference/Statements/for...of">for...of</a></code> 迴圈)。</p> </div> diff --git a/files/zh-tw/web/javascript/reference/statements/label/index.html b/files/zh-tw/web/javascript/reference/statements/label/index.html index b8ba54d920..b67148b359 100644 --- a/files/zh-tw/web/javascript/reference/statements/label/index.html +++ b/files/zh-tw/web/javascript/reference/statements/label/index.html @@ -15,8 +15,8 @@ translation_of: Web/JavaScript/Reference/Statements/label -<div class="note"> -<p>標記的迴圈或程式碼區塊非常罕見。通常可以使用函式呼叫而不是使用迴圈跳轉。</p> +<div class="notecard note"> +<p><strong>備註:</strong>標記的迴圈或程式碼區塊非常罕見。通常可以使用函式呼叫而不是使用迴圈跳轉。</p> </div> <h2 id="語法">語法</h2> diff --git a/files/zh-tw/web/javascript/reference/statements/let/index.html b/files/zh-tw/web/javascript/reference/statements/let/index.html index f3170bb603..7c0b50b552 100644 --- a/files/zh-tw/web/javascript/reference/statements/let/index.html +++ b/files/zh-tw/web/javascript/reference/statements/let/index.html @@ -165,8 +165,8 @@ let i = 10;</pre> <h3 id="Another_example_of_temporal_dead_zone_combined_with_lexical_scoping">Another example of temporal dead zone combined with lexical scoping</h3> -<p>Due to lexical scoping, the identifier<strong> "foo"</strong> inside the expression <code>(foo + 55)</code> evaluates to the <u>if block's foo</u>, and <strong>not</strong> the <u>overlying variable foo</u> with the value of 33.<br> - In that very line, the <u>if block's "foo"</u> has already been created in the lexical environment, but has not yet reached (and <strong>terminated</strong>) its initialization (which is part of the statement itself): it's still in the temporal dead zone.</p> +<p>Due to lexical scoping, the identifier<strong> "foo"</strong> inside the expression <code>(foo + 55)</code> evaluates to the <em>if block's foo</em>, and <strong>not</strong> the <em>overlying variable foo</em> with the value of 33.<br> + In that very line, the <em>if block's "foo"</em> has already been created in the lexical environment, but has not yet reached (and <strong>terminated</strong>) its initialization (which is part of the statement itself): it's still in the temporal dead zone.</p> <pre class="brush: js example-bad">function test(){ var foo = 33; @@ -176,7 +176,7 @@ let i = 10;</pre> } test();</pre> -<p>This phenomenon may confuse you in a situation like the following. The instruction <code>let n of n.a</code> is already inside the private scope of the <u>for loop's block</u>, hence the identifier<strong> "n.a"</strong> is resolved to the property 'a' of the <u>'n' object located in the first part of the instruction itself</u> ("let n"), which is still in the temporal dead zone since its declaration statement has not been reached and <strong>terminated</strong>.</p> +<p>This phenomenon may confuse you in a situation like the following. The instruction <code>let n of n.a</code> is already inside the private scope of the <em>for loop's block</em>, hence the identifier<strong> "n.a"</strong> is resolved to the property 'a' of the <em>'n' object located in the first part of the instruction itself</em> ("let n"), which is still in the temporal dead zone since its declaration statement has not been reached and <strong>terminated</strong>.</p> <pre class="brush: js example-bad">function go(n) { // n here is defined! diff --git a/files/zh-tw/web/javascript/reference/statements/return/index.html b/files/zh-tw/web/javascript/reference/statements/return/index.html index e207c2c6f3..be8cb4c346 100644 --- a/files/zh-tw/web/javascript/reference/statements/return/index.html +++ b/files/zh-tw/web/javascript/reference/statements/return/index.html @@ -58,7 +58,7 @@ a + b; <p>主控台會警告「unreachable code after return statement」(在 return 宣告後面有無法抵達的程式碼)。</p> -<div class="note">從 Gecko 40 {{geckoRelease(40)}} 開始,如果主控台發現在 return 宣告後面有無法抵達的程式碼,就會顯示警告。</div> +<div class="notecard note"><p><strong>備註:</strong>從 Gecko 40 {{geckoRelease(40)}} 開始,如果主控台發現在 return 宣告後面有無法抵達的程式碼,就會顯示警告。</p></div> <p>要避免 ASI 問題,可以添加括號:</p> diff --git a/files/zh-tw/web/javascript/reference/statements/throw/index.html b/files/zh-tw/web/javascript/reference/statements/throw/index.html index 9994f8c58c..82ba6282da 100644 --- a/files/zh-tw/web/javascript/reference/statements/throw/index.html +++ b/files/zh-tw/web/javascript/reference/statements/throw/index.html @@ -145,87 +145,11 @@ e = verifyZipCode('95060 1234'); // returns 95060 1234 <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.4</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-12.13', 'throw statement')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-throw-statement', 'throw statement')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-throw-statement', 'throw statement')}}</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/statements/var/index.html b/files/zh-tw/web/javascript/reference/statements/var/index.html index 2ef07a3afa..c3a4712301 100644 --- a/files/zh-tw/web/javascript/reference/statements/var/index.html +++ b/files/zh-tw/web/javascript/reference/statements/var/index.html @@ -155,87 +155,11 @@ console.log(typeof y); // undefined as y is local to function a</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('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Implemented in JavaScript 1.0</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-12.2', 'var statement')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-variable-statement', 'variable statement')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-variable-statement', 'variable statement')}}</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/strict_mode/index.html b/files/zh-tw/web/javascript/reference/strict_mode/index.html index b37e56f1ca..a6ebcd9b70 100644 --- a/files/zh-tw/web/javascript/reference/strict_mode/index.html +++ b/files/zh-tw/web/javascript/reference/strict_mode/index.html @@ -17,8 +17,8 @@ translation_of: Web/JavaScript/Reference/Strict_mode <p>參考 <a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode">過渡到嚴格模式</a>,如果你希望將你的程式碼在 JavaScript 語法嚴格、語法受限下執行。</p> -<div class="note"> -<p>Sometimes, you'll see the default, non-strict, mode referred to as "sloppy mode". This isn't an official term, but be aware of it, just in case.</p> +<div class="notecard note"> +<p><strong>Note:</strong> Sometimes, you'll see the default, non-strict, mode referred to as "sloppy mode". This isn't an official term, but be aware of it, just in case.</p> </div> <h2 id="用法">用法</h2> @@ -98,8 +98,8 @@ delete Object.prototype; // throws a TypeError <p>Fourth, strict mode prior to Gecko 34 requires that all properties named in an object literal be unique. Normal code may duplicate property names, with the last one determining the property's value. But since only the last one does anything, the duplication is simply a vector for bugs, if the code is modified to change the property value other than by changing the last instance. Duplicate property names are a syntax error in strict mode:</p> -<div class="note"> -<p>This is no longer the case in ECMAScript 2015 ({{bug(1041128)}}).</p> +<div class="notecard note"> +<p><strong>Note:</strong> This is no longer the case in ECMAScript 2015 ({{bug(1041128)}}).</p> </div> <pre class="brush: js">'use strict'; diff --git a/files/zh-tw/web/javascript/typed_arrays/index.html b/files/zh-tw/web/javascript/typed_arrays/index.html index 688dab7188..7213f515e1 100644 --- a/files/zh-tw/web/javascript/typed_arrays/index.html +++ b/files/zh-tw/web/javascript/typed_arrays/index.html @@ -20,7 +20,7 @@ translation_of: Web/JavaScript/Typed_arrays <p>為了追求最大的可朔性與效率,JavaScript 型別陣列的實作分為<strong>緩衝</strong>與<strong>視圖</strong>。一個緩衝(以類別 {{jsxref("ArrayBuffer")}} 實作)為代表一塊資料資料的物件,它沒有任何格式,也沒有任何存取其內容的機制。想存取一個緩衝所佔的記憶體必須用一個視圖。一個視圖提供了一種前後關係 — 資料型別、起始偏移與元素的數目 — 使得資料變成真實的型別陣列。視圖以類別 {{jsxref("ArrayBufferView")}} 與其子類別實作。</p> -<p><img alt="Typed arrays in an ArrayBuffer" src="https://mdn.mozillademos.org/files/8629/typed_arrays.png" style="height: 278px; width: 666px;"></p> +<p><img alt="Typed arrays in an ArrayBuffer" src="https://mdn.mozillademos.org/files/8629/typed_arrays.png"></p> <h3 id="ArrayBuffer">ArrayBuffer</h3> @@ -125,7 +125,7 @@ var amountDueView = new Float32Array(buffer, 20, 1); <p>舉例來說,可以用 <code>amountDueView[0]</code> 存取 amountDue。</p> -<div class="note"><strong>備註:</strong>C 結構的 <a class="external" href="http://en.wikipedia.org/wiki/Data_structure_alignment" title="http://en.wikipedia.org/wiki/Data_structure_alignment">data structure alignment</a> 是與使用平台有關,須小心這些填充上的差異。</div> +<div class="notecard note"><p><strong>備註:</strong>C 結構的 <a class="external" href="http://en.wikipedia.org/wiki/Data_structure_alignment" title="http://en.wikipedia.org/wiki/Data_structure_alignment">data structure alignment</a> 是與使用平台有關,須小心這些填充上的差異。</p></div> <h3 id="Conversion_to_normal_arrays">Conversion to normal arrays</h3> @@ -139,82 +139,11 @@ normalArray.constructor === Array; <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 2015.</td> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-typedarray-objects', 'TypedArray Objects')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initial definition in an ECMA standard.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-typedarray-objects', 'TypedArray Objects')}}</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>7.0</td> - <td>{{ CompatGeckoDesktop("2") }}</td> - <td>10</td> - <td>11.6</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("2") }}</td> - <td>10</td> - <td>11.6</td> - <td>4.2</td> - </tr> - </tbody> -</table> -</div> +{{Compat}} <h2 id="參見">參見</h2> |