From 6102f370809db5bf92444c4823b7f3212cc0e29b Mon Sep 17 00:00:00 2001 From: Hoarfroster Date: Mon, 29 Jul 2024 00:11:32 +0800 Subject: [PATCH] chores: convert noteblocks --- files/zh-tw/web/api/keyboardevent/index.md | 18 +++++++++----- files/zh-tw/web/api/nodelist/index.md | 3 ++- files/zh-tw/web/http/status/301/index.md | 3 ++- files/zh-tw/web/http/status/304/index.md | 3 ++- files/zh-tw/web/http/status/308/index.md | 3 ++- files/zh-tw/web/http/status/400/index.md | 3 ++- files/zh-tw/web/http/status/404/index.md | 3 ++- files/zh-tw/web/http/status/408/index.md | 3 ++- files/zh-tw/web/http/status/410/index.md | 3 ++- files/zh-tw/web/http/status/411/index.md | 3 ++- files/zh-tw/web/http/status/422/index.md | 3 ++- files/zh-tw/web/http/status/503/index.md | 3 ++- files/zh-tw/web/javascript/closures/index.md | 6 +++-- .../web/javascript/data_structures/index.md | 3 ++- .../control_flow_and_error_handling/index.md | 3 ++- .../guide/grammar_and_types/index.md | 6 +++-- .../javascript/guide/introduction/index.md | 3 ++- .../javascript/guide/typed_arrays/index.md | 3 ++- .../index.md | 3 ++- .../web/javascript/reference/classes/index.md | 3 ++- .../reference/errors/not_defined/index.md | 3 ++- .../global_objects/array/concat/index.md | 3 ++- .../global_objects/array/indexof/index.md | 3 ++- .../global_objects/array/reduce/index.md | 3 ++- .../reference/global_objects/bigint/index.md | 3 ++- .../global_objects/date/getday/index.md | 3 ++- .../reference/global_objects/date/index.md | 24 ++++++++++++------- .../global_objects/date/parse/index.md | 9 ++++--- .../global_objects/function/apply/index.md | 12 ++++++---- .../global_objects/function/bind/index.md | 3 ++- .../global_objects/function/call/index.md | 3 ++- .../reference/global_objects/math/index.md | 6 +++-- .../global_objects/math/random/index.md | 3 ++- .../object/defineproperty/index.md | 3 ++- .../global_objects/promise/finally/index.md | 3 ++- .../reference/global_objects/promise/index.md | 9 ++++--- .../global_objects/promise/then/index.md | 3 ++- .../reference/global_objects/set/has/index.md | 3 ++- .../reference/global_objects/string/index.md | 6 +++-- .../string/localecompare/index.md | 3 ++- .../reference/iteration_protocols/index.md | 3 ++- .../destructuring_assignment/index.md | 6 +++-- .../javascript/reference/operators/index.md | 3 ++- .../operators/optional_chaining/index.md | 3 ++- .../reference/operators/this/index.md | 9 ++++--- .../reference/operators/typeof/index.md | 6 +++-- .../statements/async_function/index.md | 3 ++- .../reference/statements/for...in/index.md | 3 ++- .../reference/statements/for...of/index.md | 3 ++- .../reference/statements/label/index.md | 3 ++- .../reference/statements/return/index.md | 3 ++- .../javascript/reference/strict_mode/index.md | 6 +++-- files/zh-tw/web/manifest/index.md | 9 ++++--- files/zh-tw/web/opensearch/index.md | 9 ++++--- .../zh-tw/web/security/mixed_content/index.md | 3 ++- .../web/security/same-origin_policy/index.md | 3 ++- .../svg/tutorial/fills_and_strokes/index.md | 3 ++- .../zh-tw/web/svg/tutorial/gradients/index.md | 3 ++- files/zh-tw/web/svg/tutorial/index.md | 3 ++- files/zh-tw/web/svg/tutorial/paths/index.md | 3 ++- 60 files changed, 184 insertions(+), 92 deletions(-) diff --git a/files/zh-tw/web/api/keyboardevent/index.md b/files/zh-tw/web/api/keyboardevent/index.md index d52b0b0fc72bf0..da168ac2a41758 100644 --- a/files/zh-tw/web/api/keyboardevent/index.md +++ b/files/zh-tw/web/api/keyboardevent/index.md @@ -35,15 +35,18 @@ _本介面( interface)亦繼承其父,{{domxref("UIEvent")}} 和 {{domxref - : 一個 {{domxref("DOMString")}} ,返回鍵盤對應的字符。若是該鍵對應一個實際的字符,則其值為對應該字符的一個非空的 Unicode 字串;若沒對應的話,則返回一個空字串。 - > **備註:** If the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character. + > [!NOTE] + > If the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character. - > **警告:** 在 DOM Level 3 Events ,該 propertie 已被移除。現在只有 IE9+ 支持它。 + > [!WARNING] + > 在 DOM Level 3 Events ,該 propertie 已被移除。現在只有 IE9+ 支持它。 - {{domxref("KeyboardEvent.charCode")}} {{Deprecated_inline}}{{Readonlyinline}} - : Returns a {{jsxref("Number")}} representing the Unicode reference number of the key; this attribute is used only by the `keypress` event. For keys whose `char` attribute contains multiple characters, this is the Unicode value of the first character in that attribute. In Firefox 26 this returns codes for printable characters. - > **警告:** 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}}。 + > [!WARNING] + > 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}}。 - {{domxref("KeyboardEvent.code")}} {{Readonlyinline}} - : 一個 {{domxref("DOMString")}} 。返回事件對應的按鍵的代碼。 @@ -57,13 +60,15 @@ _本介面( interface)亦繼承其父,{{domxref("UIEvent")}} 和 {{domxref - : Returns a {{jsxref("Number")}} representing a system and implementation dependent numerical code identifying the unmodified value of the pressed key. - > **警告:** 此 attribute 已被淘汰。如果可以,建議使用{{domxref("KeyboardEvent.key")}}。 + > [!WARNING] + > 此 attribute 已被淘汰。如果可以,建議使用{{domxref("KeyboardEvent.key")}}。 - {{domxref("KeyboardEvent.locale")}} {{Readonlyinline}} - : Returns a {{domxref("DOMString")}} representing a locale string indicating the locale the keyboard is configured for. This may be the empty string if the browser or device doesn't know the keyboard's locale. - > **備註:** This does not describe the locale of the data being entered. A user may be using one keyboard layout while typing text in a different language. + > [!NOTE] + > This does not describe the locale of the data being entered. A user may be using one keyboard layout while typing text in a different language. - {{domxref("KeyboardEvent.location")}} {{Readonlyinline}} - : Returns a {{jsxref("Number")}} representing the location of the key on the keyboard or other input device. @@ -77,7 +82,8 @@ _本介面( interface)亦繼承其父,{{domxref("UIEvent")}} 和 {{domxref - : Returns a {{jsxref("Number")}} representing a system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as `keyCode`. - > **警告:** 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}}。 + > [!WARNING] + > 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}}。 ## 注意 diff --git a/files/zh-tw/web/api/nodelist/index.md b/files/zh-tw/web/api/nodelist/index.md index 6c8ce7d7640b80..b054a66d6b59cd 100644 --- a/files/zh-tw/web/api/nodelist/index.md +++ b/files/zh-tw/web/api/nodelist/index.md @@ -7,7 +7,8 @@ slug: Web/API/NodeList **`NodeList`** 物件是節點的集合,可藉由 {{domxref("Node.childNodes")}} 屬性以及 {{domxref("document.querySelectorAll()")}} 方法取得。 -> **備註:** 雖然 `NodeList` 不是 `Array`,但仍可以使用 `forEach()` 方法來進行迭代。一些老舊瀏覽器並未實作此方法。 +> [!NOTE] +> 雖然 `NodeList` 不是 `Array`,但仍可以使用 `forEach()` 方法來進行迭代。一些老舊瀏覽器並未實作此方法。 在某些情況下,`NodeList` 為*動態集合(live collection)*,意思是 DOM 的改變會反映於集合。例如,{{domxref("Node.childNodes")}} 便是即時更新(live)的: diff --git a/files/zh-tw/web/http/status/301/index.md b/files/zh-tw/web/http/status/301/index.md index 380a4837d2b2a2..ade22b6d48a059 100644 --- a/files/zh-tw/web/http/status/301/index.md +++ b/files/zh-tw/web/http/status/301/index.md @@ -9,7 +9,8 @@ l10n: HTTP **`301 Moved Permanently`** 重新導向回應碼表示所請求的資源已被永久地移動到由 {{HTTPHeader("Location")}} 標頭給出的 URL。瀏覽器將重新導向到新的 URL,並且搜索引擎會更新對該資源的連結。 -> **備註:** 雖然[規範](#規範)要求在執行重新導向時方法和主體保持不變,但並非所有使用者代理都符合此要求。僅將 `301` 狀態碼用作 {{HTTPMethod("GET")}} 或 {{HTTPMethod("HEAD")}} 方法的回應,對於 {{HTTPMethod("POST")}} 方法,請改用 {{HTTPStatus("308", "308 Permanent Redirect")}},因為此狀態明確禁止更改方法。 +> [!NOTE] +> 雖然[規範](#規範)要求在執行重新導向時方法和主體保持不變,但並非所有使用者代理都符合此要求。僅將 `301` 狀態碼用作 {{HTTPMethod("GET")}} 或 {{HTTPMethod("HEAD")}} 方法的回應,對於 {{HTTPMethod("POST")}} 方法,請改用 {{HTTPStatus("308", "308 Permanent Redirect")}},因為此狀態明確禁止更改方法。 ## 狀態 diff --git a/files/zh-tw/web/http/status/304/index.md b/files/zh-tw/web/http/status/304/index.md index 1020c781a6557b..6da72ac3c2f69c 100644 --- a/files/zh-tw/web/http/status/304/index.md +++ b/files/zh-tw/web/http/status/304/index.md @@ -11,7 +11,8 @@ HTTP **`304 Not Modified`** 重新導向回應碼表示無需重新傳送所請 回應不得包含主體,並且必須包括與等效的 {{HTTPStatus("200")}} `OK` 回應中會發送的標頭:{{HTTPHeader("Cache-Control")}}、{{HTTPHeader("Content-Location")}}、{{HTTPHeader("Date")}}、{{HTTPHeader("ETag")}}、{{HTTPHeader("Expires")}} 和 {{HTTPHeader("Vary")}}。 -> **備註:** 許多[開發者工具的「網路」面板](https://firefox-source-docs.mozilla.org/devtools-user/network_monitor/index.html)會創建多餘的請求,導致出現 `304` 回應,這樣開發人員就可以查看對本地緩存的訪問。 +> [!NOTE] +> 許多[開發者工具的「網路」面板](https://firefox-source-docs.mozilla.org/devtools-user/network_monitor/index.html)會創建多餘的請求,導致出現 `304` 回應,這樣開發人員就可以查看對本地緩存的訪問。 ## 狀態 diff --git a/files/zh-tw/web/http/status/308/index.md b/files/zh-tw/web/http/status/308/index.md index bec1407161c27d..3d766e71c589bd 100644 --- a/files/zh-tw/web/http/status/308/index.md +++ b/files/zh-tw/web/http/status/308/index.md @@ -11,7 +11,8 @@ HTTP **`308 Permanent Redirect`** 永久重新導向狀態碼表示所請求的 請求方法和主體不會被更改,而 {{HTTPStatus("301")}} 有時可能會錯誤地被更改為 {{HTTPMethod("GET")}} 方法。 -> **備註:** 一些 Web 應用可能會以非標準方式使用 `308 Permanent Redirect`,並用於其他目的。例如 Google Drive 使用 `308 Resume Incomplete` 回應來指示用戶端不完整的上傳停滯。(請參見 Google Drive 文件上的[執行可恢復的下載](https://developers.google.com/drive/api/guides/manage-uploads?hl=zh-tw)) +> [!NOTE] +> 一些 Web 應用可能會以非標準方式使用 `308 Permanent Redirect`,並用於其他目的。例如 Google Drive 使用 `308 Resume Incomplete` 回應來指示用戶端不完整的上傳停滯。(請參見 Google Drive 文件上的[執行可恢復的下載](https://developers.google.com/drive/api/guides/manage-uploads?hl=zh-tw)) ## 狀態 diff --git a/files/zh-tw/web/http/status/400/index.md b/files/zh-tw/web/http/status/400/index.md index 3dd0fedd470eb3..2d042b8f50e611 100644 --- a/files/zh-tw/web/http/status/400/index.md +++ b/files/zh-tw/web/http/status/400/index.md @@ -9,7 +9,8 @@ l10n: 超文本傳輸協定(HTTP)**`400 Bad Request`** 回應狀態碼表示由於用戶端的錯誤(例如請求語法的格式錯誤、請求訊息框架無效或欺騙性的請求路由),伺服器無法或不會處理請求。 -> **警告:** 用戶端不應原封不動的重複此要求。 +> [!WARNING] +> 用戶端不應原封不動的重複此要求。 ## 狀態 diff --git a/files/zh-tw/web/http/status/404/index.md b/files/zh-tw/web/http/status/404/index.md index fe59970dc7b0ce..996ab4a6850cc1 100644 --- a/files/zh-tw/web/http/status/404/index.md +++ b/files/zh-tw/web/http/status/404/index.md @@ -27,7 +27,8 @@ ErrorDocument 404 /notfound.html 有關自訂 404 頁面的範例,請參見此 [404 頁面](https://konmari.com/404)。 -> **備註:** 適度地自訂設計是一個好事情。可以使你的 404 頁面幽默和人性化,但不要讓你的用戶感到困惑。 +> [!NOTE] +> 適度地自訂設計是一個好事情。可以使你的 404 頁面幽默和人性化,但不要讓你的用戶感到困惑。 ## 規範 diff --git a/files/zh-tw/web/http/status/408/index.md b/files/zh-tw/web/http/status/408/index.md index 9530c7e5038a9b..a7934016415672 100644 --- a/files/zh-tw/web/http/status/408/index.md +++ b/files/zh-tw/web/http/status/408/index.md @@ -13,7 +13,8 @@ HTTP **`408 Request Timeout`** 回應狀態碼表示伺服器希望關閉這個 自從一些瀏覽器(如 Chrome、Firefox 27+ 和 IE9)使用 HTTP 預連接機制來加速瀏覽以來,這個回應被更多地使用。 -> **備註:** 一些伺服器僅關閉連接而不發送此訊息。 +> [!NOTE] +> 一些伺服器僅關閉連接而不發送此訊息。 ## 狀態 diff --git a/files/zh-tw/web/http/status/410/index.md b/files/zh-tw/web/http/status/410/index.md index 42d4b30ad19100..4e1420ed585847 100644 --- a/files/zh-tw/web/http/status/410/index.md +++ b/files/zh-tw/web/http/status/410/index.md @@ -11,7 +11,8 @@ HTTP **`410 Gone`** 用戶端錯誤回應碼表示在原始伺服器上已不再 如果你不知道這種情況是暫時的還是永久的,則應改用 {{HTTPStatus(404)}} 狀態碼。 -> **備註:** 預設情況下,410 回應是可緩存的。 +> [!NOTE] +> 預設情況下,410 回應是可緩存的。 ## 狀態 diff --git a/files/zh-tw/web/http/status/411/index.md b/files/zh-tw/web/http/status/411/index.md index 99264aa7727993..ae926bc17c6896 100644 --- a/files/zh-tw/web/http/status/411/index.md +++ b/files/zh-tw/web/http/status/411/index.md @@ -9,7 +9,8 @@ l10n: HTTP **`411 Length Required`** 用戶端錯誤回應碼表示伺服器拒絕接受沒有定義 {{HTTPHeader("Content-Length")}} 標頭的請求。 -> **備註:** 根據規範,在以一系列塊發送數據時,會省略 `Content-Length` 標頭,而在每個塊的開頭需要以十六進制格式添加當前塊的長度。詳情請參見 {{HTTPHeader("Transfer-Encoding")}}。 +> [!NOTE] +> 根據規範,在以一系列塊發送數據時,會省略 `Content-Length` 標頭,而在每個塊的開頭需要以十六進制格式添加當前塊的長度。詳情請參見 {{HTTPHeader("Transfer-Encoding")}}。 ## 狀態 diff --git a/files/zh-tw/web/http/status/422/index.md b/files/zh-tw/web/http/status/422/index.md index 9f043793ada1d5..2c3a8f2344c049 100644 --- a/files/zh-tw/web/http/status/422/index.md +++ b/files/zh-tw/web/http/status/422/index.md @@ -9,7 +9,8 @@ l10n: 超文本傳輸協定(HTTP)**`422 Unprocessable Content`** 回應狀態碼表示伺服器理解請求實體的內容類型,並且請求實體的語法是正確的,但無法處理其中包含的指示。 -> **警告:** 用戶端不應該在未修改的情況下重複此請求。 +> [!WARNING] +> 用戶端不應該在未修改的情況下重複此請求。 ## 狀態 diff --git a/files/zh-tw/web/http/status/503/index.md b/files/zh-tw/web/http/status/503/index.md index 6b3caf5a6ef821..5bea1d3e3e9453 100644 --- a/files/zh-tw/web/http/status/503/index.md +++ b/files/zh-tw/web/http/status/503/index.md @@ -11,7 +11,8 @@ l10n: 常見原因是伺服器正在進行維護或超載。此回應應用於臨時情況,如果可能,{{HTTPHeader("Retry-After")}} HTTP 標頭應包含恢復服務的預估時間。 -> **備註:** 伴隨此回應,應發送一個友好的頁面來解釋問題。 +> [!NOTE] +> 伴隨此回應,應發送一個友好的頁面來解釋問題。 與此回應一起發送的與緩存相關的標頭應該被處理,因為 503 狀態通常是一個臨時條件,通常不應該將回應緩存。 diff --git a/files/zh-tw/web/javascript/closures/index.md b/files/zh-tw/web/javascript/closures/index.md index 5949bddc7b20bf..f9654c9b0c83cc 100644 --- a/files/zh-tw/web/javascript/closures/index.md +++ b/files/zh-tw/web/javascript/closures/index.md @@ -172,7 +172,8 @@ console.log(counter.value()); // logs 1 這三個公有函式,皆為共享同一個環境的閉包。由於 JavaScript 的語法作用域,它們都能訪問 `privateCounter` 變數與 `changeBy` 函式。 -> **備註:** 你應該也發現到我們定義了建立 counter 的匿名函式、而我們接著呼叫它,並給`counter` 變數指派了回傳值。我們也能在分離的變數 `makeCounter` 儲存函式並用其建立數個 counter。 +> [!NOTE] +> 你應該也發現到我們定義了建立 counter 的匿名函式、而我們接著呼叫它,並給`counter` 變數指派了回傳值。我們也能在分離的變數 `makeCounter` 儲存函式並用其建立數個 counter。 ```js var makeCounter = function () { @@ -206,7 +207,8 @@ alert(counter2.value()); /* Alerts 0 */ 請注意 `counter1` 與 `counter2` 這兩個計數器是如何維護其獨立性的。每個閉包都以各自的閉包,在參照不同版本的 `privateCounter` 變數。每當呼叫其中一個計數器時,它會透過該變數的數值變更,改變語法作用域的環境。不過,在其中一個閉包的變數值改時,其他閉包的數值並不會受到影響。 -> **備註:** 使用這種方法的閉包,提供了一些與物件導向程式設計的益處,尤其是資料隱藏與封裝。 +> [!NOTE] +> 使用這種方法的閉包,提供了一些與物件導向程式設計的益處,尤其是資料隱藏與封裝。 ## 在迴圈建立閉包:一個常見錯誤 diff --git a/files/zh-tw/web/javascript/data_structures/index.md b/files/zh-tw/web/javascript/data_structures/index.md index 8268bf369888f4..c80b6084ba157d 100644 --- a/files/zh-tw/web/javascript/data_structures/index.md +++ b/files/zh-tw/web/javascript/data_structures/index.md @@ -129,7 +129,8 @@ Associates a key with one or two accessor functions (get and set) to retrieve or | [[Enumerable]] | Boolean | If `true`, the property will be enumerated in [for...in](/zh-TW/docs/Web/JavaScript/Reference/Statements/for...in) loops. | false | | [[Configurable]] | Boolean | If `false`, the property can't be deleted and can't be changed to a data property. | false | -> **備註:** Attribute is usually used by JavaScript engine, so you can't directly access it(see more about [Object.defineProperty()](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)).That's why the attribute is put in double square brackets instead of single. +> [!NOTE] +> Attribute is usually used by JavaScript engine, so you can't directly access it(see more about [Object.defineProperty()](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)).That's why the attribute is put in double square brackets instead of single. ### "Normal" objects, and functions diff --git a/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.md b/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.md index e078414507b17a..6a7efef5bf79a4 100644 --- a/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.md +++ b/files/zh-tw/web/javascript/guide/control_flow_and_error_handling/index.md @@ -240,7 +240,8 @@ throw { }; ``` -> **備註:** 你可以在拋出例外時指定物件。然後,可以在 catch 區塊中引用對象的屬性。 +> [!NOTE] +> 你可以在拋出例外時指定物件。然後,可以在 catch 區塊中引用對象的屬性。 ```js // 創建類型爲 UserException 的物件 diff --git a/files/zh-tw/web/javascript/guide/grammar_and_types/index.md b/files/zh-tw/web/javascript/guide/grammar_and_types/index.md index c229a18314736d..eb564483a83dc1 100644 --- a/files/zh-tw/web/javascript/guide/grammar_and_types/index.md +++ b/files/zh-tw/web/javascript/guide/grammar_and_types/index.md @@ -348,7 +348,8 @@ y = 42 + " is the answer"; // "42 is the answer" var coffees = ["French Roast", "Colombian", "Kona"]; ``` -> **備註:** An array literal is a type of object initializer. See [Using Object Initializers](/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Using_object_initializers). +> [!NOTE] +> An array literal is a type of object initializer. See [Using Object Initializers](/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Using_object_initializers). 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. @@ -366,7 +367,8 @@ This array has two elements with values and one empty element (`fish[0]` is "Lio 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 `myList[3]`. All other commas in the list indicate a new element. -> **備註:** Trailing commas can create errors in older browser versions and it is a best practice to remove them. +> [!NOTE] +> Trailing commas can create errors in older browser versions and it is a best practice to remove them. ```js var myList = ["home", , "school"]; diff --git a/files/zh-tw/web/javascript/guide/introduction/index.md b/files/zh-tw/web/javascript/guide/introduction/index.md index f1eabe4fe2ab07..09ee11fb16bada 100644 --- a/files/zh-tw/web/javascript/guide/introduction/index.md +++ b/files/zh-tw/web/javascript/guide/introduction/index.md @@ -125,7 +125,8 @@ ECMAScript 規格(ECMA-262)在 Netscape 和 Ecma International 的密切合 -> **備註:** ECMA-262 第 2 版是由已修正錯誤的第 1 版並加上些微的更動構成。現今由 Ecma International 的 TC39 工作組(TC39 Working Group)所發行的版本是 ECMAScript 5.1 版 +> [!NOTE] +> ECMA-262 第 2 版是由已修正錯誤的第 1 版並加上些微的更動構成。現今由 Ecma International 的 TC39 工作組(TC39 Working Group)所發行的版本是 ECMAScript 5.1 版 [JavaScript Reference](/zh-TW/docs/JavaScript/Reference) 指出了哪些 JavaScript 的特性是相容於 ECMAScript 的。 diff --git a/files/zh-tw/web/javascript/guide/typed_arrays/index.md b/files/zh-tw/web/javascript/guide/typed_arrays/index.md index 1112d1877a010a..d68a807e6a2c0a 100644 --- a/files/zh-tw/web/javascript/guide/typed_arrays/index.md +++ b/files/zh-tw/web/javascript/guide/typed_arrays/index.md @@ -139,7 +139,8 @@ var amountDueView = new Float32Array(buffer, 20, 1); 舉例來說,可以用 `amountDueView[0]` 存取 amountDue。 -> **備註:** C 結構的 [data structure alignment](http://en.wikipedia.org/wiki/Data_structure_alignment) 是與使用平台有關,須小心這些填充上的差異。 +> [!NOTE] +> C 結構的 [data structure alignment](http://en.wikipedia.org/wiki/Data_structure_alignment) 是與使用平台有關,須小心這些填充上的差異。 ### Conversion to normal arrays diff --git a/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.md b/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.md index 7187e8a882f0f6..e7818b06f03443 100644 --- a/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.md +++ b/files/zh-tw/web/javascript/inheritance_and_the_prototype_chain/index.md @@ -19,7 +19,8 @@ JavaScript 是個沒有實做 `class` 關鍵字的動態語言,所以會對那 JavaScript 物件是一「包」動態的屬性(也就是**它自己**的屬性)並擁有一個原型物件的鏈結,當物件試圖存取一個物件的屬性時,其不僅會尋找該物件,也會尋找該物件的原型、原型的原型……直到找到相符合的屬性,或是到達原型鏈的尾端。 -> **備註:** 遵照 ECMAScript 標準的 `someObject.[[Prototype]]` 標記,用於指派 `someObject` 的原型。從 ECMAScript 2015 開始, `[[Prototype]]` 使用 {{jsxref("Object.getPrototypeOf()")}} 與 {{jsxref("Object.setPrototypeOf()")}} 這兩個訪問器(accessors)訪問,等同於非標準,但各大瀏覽器已實做的 `__proto__` 屬性。 +> [!NOTE] +> 遵照 ECMAScript 標準的 `someObject.[[Prototype]]` 標記,用於指派 `someObject` 的原型。從 ECMAScript 2015 開始, `[[Prototype]]` 使用 {{jsxref("Object.getPrototypeOf()")}} 與 {{jsxref("Object.setPrototypeOf()")}} 這兩個訪問器(accessors)訪問,等同於非標準,但各大瀏覽器已實做的 `__proto__` 屬性。 > > 不要把 `someObject.[[Prototype]]` 與函式屬性 `func.prototype` 混淆了。它在函式被用作建構子的時候,指定 `[[Prototype]]` 要分派到所有由給定函式建立的物件實例(instance)。**`Object.prototype`** 屬性代表了原型屬性 {{jsxref("Object")}}。 diff --git a/files/zh-tw/web/javascript/reference/classes/index.md b/files/zh-tw/web/javascript/reference/classes/index.md index 1252aa5364f547..711fe4212d182b 100644 --- a/files/zh-tw/web/javascript/reference/classes/index.md +++ b/files/zh-tw/web/javascript/reference/classes/index.md @@ -178,7 +178,8 @@ class Rectangle { 通過宣告這些在類別以外不可見的東西,你可以確保類別的使用者不會倚賴類別的內部結構,畢竟一個類別的內部結構可能會隨著版本的更新而有所變化。 -> **備註:** 私有欄位只能在建立類別時事先宣告。 +> [!NOTE] +> 私有欄位只能在建立類別時事先宣告。 私有欄位不像普通欄位一樣,可以在類別宣告完後才建立。 diff --git a/files/zh-tw/web/javascript/reference/errors/not_defined/index.md b/files/zh-tw/web/javascript/reference/errors/not_defined/index.md index 523db710f1d157..5008c712a0b338 100644 --- a/files/zh-tw/web/javascript/reference/errors/not_defined/index.md +++ b/files/zh-tw/web/javascript/reference/errors/not_defined/index.md @@ -19,7 +19,8 @@ ReferenceError: "x" is not defined 有個地方參照到不存在的變數了。這個變數需要宣告、或確定在目前腳本、或在 {{Glossary("scope")}} 裡可用。 -> **備註:** 如果要使用函式庫(例如 jQuery)的話,請確定在你使用諸如 $ 這樣的函式庫變數前,就已載入完畢。把載入函式庫的 {{HTMLElement("script")}} 標籤,放在你使用的程式碼之前。 +> [!NOTE] +> 如果要使用函式庫(例如 jQuery)的話,請確定在你使用諸如 $ 這樣的函式庫變數前,就已載入完畢。把載入函式庫的 {{HTMLElement("script")}} 標籤,放在你使用的程式碼之前。 ## 實例 diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.md b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.md index 912015b0103346..56d55a27a5725e 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.md @@ -33,7 +33,8 @@ var new_array = old_array.concat(value1[, value2[, ...[, valueN]]]) - 物件參考(並非為實際的物件):`concat` 複製物件的參考至新的陣列。不管是原始的還是新的陣列都參考到相同的物件。也就是說,如果一個被參照的物件被修改了,變動會同時反映到新的以及原始的陣列中。 - 資料型態為字串、數值或是布林(非 {{jsxref("Global_Objects/String", "String")}}、{{jsxref("Global_Objects/Number", "Number")}} 及 {{jsxref("Global_Objects/Boolean", "Boolean")}} 物件):`concat` 複製字串及數值的值到新的陣列。 -> **備註:** 合併(多個)陣列/(多個)值將讓原始的陣列不會被受到影響。此外,任何對新陣列(只有在元素不是物件參考的情況下)的操作都不會影響原始的陣列,反之亦然。 +> [!NOTE] +> 合併(多個)陣列/(多個)值將讓原始的陣列不會被受到影響。此外,任何對新陣列(只有在元素不是物件參考的情況下)的操作都不會影響原始的陣列,反之亦然。 ## 範例 diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.md b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.md index a30e258087c633..5a36f122c56c31 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Array/indexOf **`indexOf()`** 方法會回傳給定元素於陣列中第一個被找到之索引,若不存在於陣列中則回傳 -1。 -> **備註:** 若是調用字串的方法,請參閱 {{jsxref("String.prototype.indexOf()")}}。 +> [!NOTE] +> 若是調用字串的方法,請參閱 {{jsxref("String.prototype.indexOf()")}}。 {{EmbedInteractiveExample("pages/js/array-indexof.html")}} diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.md b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.md index 44a81242aaadef..41796f81016103 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.md @@ -48,7 +48,8 @@ arr.reduce(callback[accumulator, currentValue, currentIndex, array], initialValu 當回呼函式第一次被呼叫時,`accumulator` 與 `currentValue` 的值可能為兩種不同的狀況:若在呼叫 `reduce()` 時有提供 `initialValue`,則 `accumulator` 將會等於 `initialValue`,且 `currentValue` 會等於陣列中的第一個元素值;若沒有提供 `initialValue`,則 `accumulator` 會等於陣列的第一個元素值,且 `currentValue` 將會等於陣列的第二個元素值。 -> **備註:** 假如 `initialValue` 未被提供,`reduce()` 將會跳過第一個陣列索引,從陣列索引 1 開始執行回呼函式。若有提供 `initialValue`,則會由陣列索引 0 開始執行。 +> [!NOTE] +> 假如 `initialValue` 未被提供,`reduce()` 將會跳過第一個陣列索引,從陣列索引 1 開始執行回呼函式。若有提供 `initialValue`,則會由陣列索引 0 開始執行。 若陣列為空且沒有提供 `initialValue`,將會拋出 {{jsxref("TypeError")}}。假如陣列只有一個元素(無論其索引位置為何)並且沒有提供 `initialValue`,或如果提供了 `initialValue` 但陣列為空,則此唯一的值將會被直接回傳*而不會呼叫 `callback` 函式*。 diff --git a/files/zh-tw/web/javascript/reference/global_objects/bigint/index.md b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.md index cf1250076586d6..8cba5d82f4fd3d 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/bigint/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.md @@ -95,7 +95,8 @@ bigN * -1n `/` 運算子也同樣的能夠運行。然而,因為型態是 `BigInt` 而不是 `BigDecimal` ,除法運算會無條件捨去小數。也就是說,回傳值不會包含小數部分。 -> **警告:** 回傳值帶小數的運算在使用`BigInt` 時小數部分會被捨去。 +> [!WARNING] +> 回傳值帶小數的運算在使用`BigInt` 時小數部分會被捨去。 ```js const expected = 4n / 2n; diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.md b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.md index a1e77dfc9340b8..05bca63cbe0594 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.md @@ -32,7 +32,8 @@ var weekday = Xmas95.getDay(); console.log(weekday); // 1 ``` -> **備註:** 如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}加上`options`參數來獲取星期幾全名。使使用此方法能輕鬆做出各種國際語言: +> [!NOTE] +> 如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}加上`options`參數來獲取星期幾全名。使使用此方法能輕鬆做出各種國際語言: > > ```js > var options = { weekday: "long" }; diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/index.md b/files/zh-tw/web/javascript/reference/global_objects/date/index.md index c6225d0d0709cf..b837f9aa66afd0 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/date/index.md @@ -16,13 +16,16 @@ new Date(dateString); new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); ``` -> **備註:** JavaScript `Date` 物件只能由以 Date 作為建構子來產生,如果把 Date 作為一般的函數來呼叫(省略掉 {{jsxref("Operators/new", "new")}} 運算子)將會得到一個字串而非 Date 物件;與其它 JavaScript 物件不同,它並沒有物件實體語法(例如:以中刮號 \[ ] 表示陣列的宣告方式)。 +> [!NOTE] +> JavaScript `Date` 物件只能由以 Date 作為建構子來產生,如果把 Date 作為一般的函數來呼叫(省略掉 {{jsxref("Operators/new", "new")}} 運算子)將會得到一個字串而非 Date 物件;與其它 JavaScript 物件不同,它並沒有物件實體語法(例如:以中刮號 \[ ] 表示陣列的宣告方式)。 ### 參數 -> **備註:** 當傳入超過一個參數到 Date 建構子,若參數值超過它的合理範圍(例如:傳數值 13 到月份,或傳數值 70 給分鐘),相鄰的參數值將會被調整。例如: `new Date(2013, 13, 1)` 將等同於 `new Date(2014, 1, 1)` 都會建立代表 `2014-02-01` 的物件(注意月份值由 0 開始)。同樣的, `new Date(2013, 2, 1, 0, 70)` 與 `new Date(2013, 2, 1, 1, 10)` 一樣會建立代表 `2013-03-01T01:10:00` 的 Date 物件。 +> [!NOTE] +> 當傳入超過一個參數到 Date 建構子,若參數值超過它的合理範圍(例如:傳數值 13 到月份,或傳數值 70 給分鐘),相鄰的參數值將會被調整。例如: `new Date(2013, 13, 1)` 將等同於 `new Date(2014, 1, 1)` 都會建立代表 `2014-02-01` 的物件(注意月份值由 0 開始)。同樣的, `new Date(2013, 2, 1, 0, 70)` 與 `new Date(2013, 2, 1, 1, 10)` 一樣會建立代表 `2013-03-01T01:10:00` 的 Date 物件。 -> **備註:** 當傳入超過一個參數到 Date 建構子,所指定的參數值會視為本地時間。如果希望指定的值為世界標準時間(UTC),則應使用 `new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}})` 語法,傳入一樣格式的參數。 +> [!NOTE] +> 當傳入超過一個參數到 Date 建構子,所指定的參數值會視為本地時間。如果希望指定的值為世界標準時間(UTC),則應使用 `new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}})` 語法,傳入一樣格式的參數。 - `value` - : 自世界標準時間(UTC) 1970 年 1 月 1 日 00:00:00 開始的毫秒整數(Integer)值(Unix 紀元;但要注意到大多 Unix 時間戳記是以秒而非毫秒為單位)。 @@ -30,7 +33,8 @@ new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); - : 表示時間日期的字串。這個字串應該要能被 {{jsxref("Date.parse()")}} 方法解析(符合 [IETF-compliant RFC 2822 timestamps](http://tools.ietf.org/html/rfc2822#page-14) 及 [version of ISO8601](http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15) 格式要求). - > **備註:** 由於各家瀏覽器有所不同且具有差異性,因此非常不鼓勵使用 Date 建構子(或 `Date.parse` 方法,它們是同等的)來解析時間日期字串。 + > [!NOTE] + > 由於各家瀏覽器有所不同且具有差異性,因此非常不鼓勵使用 Date 建構子(或 `Date.parse` 方法,它們是同等的)來解析時間日期字串。 - `year` - : 表示年份的整數。當數值落在 0 到 99 之間,表示 1900 到 1999 之間的年份。參考[下面的範例](#兩位數的年份對應到_1900_-_1999). @@ -71,7 +75,8 @@ new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); - : 解析字串所表示的時間,回傳由 1970/01/01 00:00:00 (UTC) 到該時間的毫秒數值。 - > **備註:** 由於瀏覽器之間的不同與差異,強烈不建議使用 `Date.parse` 。 + > [!NOTE] + > 由於瀏覽器之間的不同與差異,強烈不建議使用 `Date.parse` 。 - {{jsxref("Date.UTC()")}} - : 需要傳入與建構子相同的參數數目(即 2 到 7 個),會得到由 1970-01-01 00:00:00 UTC 到該日期時間的毫秒數。(輸入的參數會視為世界標準時間,而非本地時間) @@ -88,7 +93,8 @@ new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); - : 解析字串所表示的時間,回傳由 1970/01/01 00:00:00 (UTC) 到該時間的毫秒數值。 - > **備註:** 由於瀏覽器之間的不同與差異,強烈不建議使用 `Date.parse` 。 + > [!NOTE] + > 由於瀏覽器之間的不同與差異,強烈不建議使用 `Date.parse` 。 - {{jsxref("Date.UTC()")}} - : 需要傳入與建構子相同的參數數目(即 2 到 7 個),會得到由 1970-01-01 00:00:00 UTC 到該日期時間的毫秒數。(輸入的參數會視為世界標準時間,而非本地時間) @@ -99,7 +105,8 @@ new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); 接下來的幾個範例,展示幾種建立 Date 物件的方式: -> **備註:** 由於瀏覽器之間的不同與差異,強烈不建議使用解析字串的方式建立 Date 物件。 +> [!NOTE] +> 由於瀏覽器之間的不同與差異,強烈不建議使用解析字串的方式建立 Date 物件。 ```js var today = new Date(); @@ -164,7 +171,8 @@ function printElapsedTime(fTest) { yourFunctionReturn = printElapsedTime(yourFunction); ``` -> **備註:** 在瀏覽器支援 {{domxref("window.performance", "Web Performance API", "", 1)}} 高精度特性下, {{domxref("Performance.now()")}} 可以提供比 {{jsxref("Date.now()")}} 更可靠、精確的執行時間測試結果。 +> [!NOTE] +> 在瀏覽器支援 {{domxref("window.performance", "Web Performance API", "", 1)}} 高精度特性下, {{domxref("Performance.now()")}} 可以提供比 {{jsxref("Date.now()")}} 更可靠、精確的執行時間測試結果。 ## 規範 diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/parse/index.md b/files/zh-tw/web/javascript/reference/global_objects/date/parse/index.md index 6928d0f52fb8bb..2abe1cb4068370 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/date/parse/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/date/parse/index.md @@ -45,7 +45,8 @@ Date.parse(dateString) ### 退回至實作定義的日期格式 -> **備註:** 此段落包含因實作而異的行為,不同實作間可能不一致。 +> [!NOTE] +> 此段落包含因實作而異的行為,不同實作間可能不一致。 ECMAScript 規範表明:如果字串不符合標準格式,函式可能會退回至實作定義的啟發式或解析演算法。無法辨識的字串或包含無效值的 ISO 格式字串將使 `Date.parse()` 回傳 {{jsxref("NaN")}}。 @@ -86,7 +87,8 @@ Date.parse("foo-bar 2014"); ### 假定時區上的差異 -> **備註:** 此段落包含因實作而異的行為,不同實作間可能不一致。 +> [!NOTE] +> 此段落包含因實作而異的行為,不同實作間可能不一致。 給定一非標準的字串 `"March 7, 2014"`,`parse()` 會假定為本地時區;但如果是簡化版的 ISO 8601 日曆日期延伸格式的字串,如 `"2014-03-07"`,則會假定為 UTC 時區。故,除非系統為 UTC 時區,否則依支援的 ECMAScript 版本,由該字串產生的 {{jsxref("Date")}} 物件可能呈現不同時間。亦即兩個看似相等的日期字串,依傳入的格式而可能產生不同解析結果。 @@ -110,7 +112,8 @@ Date.parse("2019-01-01T00:00:00"); ### 非標準的日期字串 -> **備註:** 此段落包含因實作而異的行為,不同實作間可能不一致。 +> [!NOTE] +> 此段落包含因實作而異的行為,不同實作間可能不一致。 若 `ipoDate` 為既有的 {{jsxref("Date")}} 物件,可將其設定為本地時間的 1995-08-09,如下: diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.md b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.md index 19261725053071..f41d38c7715e42 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Function/apply `apply()` 方法會呼叫一個以 this 的代表值和一個陣列形式的值組(或是一個 [array-like object](/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects))為參數的函式。 -> **備註:** 這個函式的語法和 {{jsxref("Function.call", "call()")}} 幾乎一樣,最大的不同是 `call()` 接受**一連串的參數**,而 `apply()` 接受一組陣列形式的參數。 +> [!NOTE] +> 這個函式的語法和 {{jsxref("Function.call", "call()")}} 幾乎一樣,最大的不同是 `call()` 接受**一連串的參數**,而 `apply()` 接受一組陣列形式的參數。 ## 語法 @@ -36,7 +37,8 @@ fun.apply(thisArg, [argsArray]) 從 ECMAScript 5th 版本後,也可以使用陣列形式的物件,在實踐上這代表他會擁有 `length` 以及整數範圍 `(0...length-1)` 的屬性。舉例來說,你可以使用 {{domxref("NodeList")}} 或是一個像這樣的自定義屬性:`{ 'length': 2, '0': 'eat', '1': 'bananas' }`。 -> **備註:** 一般瀏覽器,包括 Chrome 14 及 Internet Explorer 9,仍不支援陣列形式的物件,所以會對此丟出一個錯誤。 +> [!NOTE] +> 一般瀏覽器,包括 Chrome 14 及 Internet Explorer 9,仍不支援陣列形式的物件,所以會對此丟出一個錯誤。 ## 範例 @@ -52,7 +54,8 @@ Function.prototype.construct = function (aArgs) { }; ``` -> **備註:** 如上範例的 `Object.create()` 方法是屬於比較新的寫法。如需使用閉包的替代方法,請參考以下的範例: +> [!NOTE] +> 如上範例的 `Object.create()` 方法是屬於比較新的寫法。如需使用閉包的替代方法,請參考以下的範例: > > ```js > Function.prototype.construct = function (aArgs) { @@ -82,7 +85,8 @@ console.log(myInstance instanceof MyConstructor); // logs 'true' console.log(myInstance.constructor); // logs 'MyConstructor' ``` -> **備註:** This non-native `Function.construct` 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: `[2012, 11, 4]`; in this case you have to write something like: `new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()` — anyhow this is not the best way to do things and probably should not be used in any production environment). +> [!NOTE] +> This non-native `Function.construct` 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: `[2012, 11, 4]`; in this case you have to write something like: `new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()` — anyhow this is not the best way to do things and probably should not be used in any production environment). ### 使用 `apply` 於內建的函數 diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.md b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.md index 85ac6936763548..e124d6a95f1e64 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.md @@ -111,7 +111,8 @@ flower.bloom(); ### Bound functions used as constructors -> **警告:** This section demonstrates JavaScript capabilities and documents some edge cases of the `bind()` method. The methods shown below are not the best way to do things and probably should not be used in any production environment. +> [!WARNING] +> This section demonstrates JavaScript capabilities and documents some edge cases of the `bind()` method. The methods shown below are not the best way to do things and probably should not be used in any production environment. Bound functions are automatically suitable for use with the {{jsxref("Operators/new", "new")}} operator to construct new instances created by the target function. When a bound function is used to construct a value, the provided `this` is ignored. However, provided arguments are still prepended to the constructor call: diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/call/index.md b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.md index b2ae7058df5e58..23490cfc9b3a33 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/function/call/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Function/call 使用給定的 `this` 參數以及分別給定的參數來呼叫某個函數 -> **備註:** 此函數的所有語法大致上與 [`apply()`](/zh-TW/docs/JavaScript/Reference/Global_Objects/Function/apply) 相同,他們基本上不同處只有 `call()` 接受一連串的參數,而 `apply()` 單一的 array 作為參數 +> [!NOTE] +> 此函數的所有語法大致上與 [`apply()`](/zh-TW/docs/JavaScript/Reference/Global_Objects/Function/apply) 相同,他們基本上不同處只有 `call()` 接受一連串的參數,而 `apply()` 單一的 array 作為參數 diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/index.md b/files/zh-tw/web/javascript/reference/global_objects/math/index.md index 762e3e3993a4f8..d0d724d8789461 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/math/index.md @@ -32,9 +32,11 @@ slug: Web/JavaScript/Reference/Global_Objects/Math ## 方法 -> **備註:** 三角函數 (`sin()`, `cos()`, `tan()`, `asin()`, `acos()`, `atan()`, `atan2()`) 的參數或回傳值的角度皆以弧度為單位。把角度乘上 `(Math.PI / 180)` 會得到弧度單位,將弧度除以該數則會轉換回一般所用的角度單位。 +> [!NOTE] +> 三角函數 (`sin()`, `cos()`, `tan()`, `asin()`, `acos()`, `atan()`, `atan2()`) 的參數或回傳值的角度皆以弧度為單位。把角度乘上 `(Math.PI / 180)` 會得到弧度單位,將弧度除以該數則會轉換回一般所用的角度單位。 -> **備註:** 許多數學方法的精度是取決於實作方式的。這意味著不同的瀏覽器可能會得到不同的結果,甚至同一個 JS 引擎在不同的作業系統或架構上所得到的結果都有可能相異。 +> [!NOTE] +> 許多數學方法的精度是取決於實作方式的。這意味著不同的瀏覽器可能會得到不同的結果,甚至同一個 JS 引擎在不同的作業系統或架構上所得到的結果都有可能相異。 - {{jsxref("Global_Objects/Math/abs", "Math.abs(x)")}} - : 回傳 x 的絕對值。 diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.md b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.md index 49000bcfc9a914..3dd38e0df190f7 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.md @@ -55,7 +55,8 @@ function getRandomInt(min, max) { } ``` -> **備註:** might be tempting to use `Math.round()` 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. +> [!NOTE] +> might be tempting to use `Math.round()` 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. ### Getting a random integer between two values, inclusive diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.md b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.md index 75d1deac21a8cc..8e28ef0aa24517 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Object/defineProperty 靜態方法 **`Object.defineProperty()`** 會直接對一個物件定義、或是修改現有的屬性。執行後會回傳定義完的物件。 -> **備註:** 這個方法會直接針對 {{jsxref("Object")}} 呼叫建構子(constructor),而不是 `Object` 型別的實例。 +> [!NOTE] +> 這個方法會直接針對 {{jsxref("Object")}} 呼叫建構子(constructor),而不是 `Object` 型別的實例。 {{EmbedInteractiveExample("pages/js/object-defineproperty.html")}} diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.md b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.md index e722100c9edfc3..c4d058f69b4955 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.md @@ -40,7 +40,8 @@ p.finally(function () { - 與 `Promise.resolve(2).then(() => {}, () => {})`(將被 resolved 為`undefined`)不同,`Promise.resolve(2).finally(() => {})` 將被 resolved 為`2`。 - 同樣的,與 `Promise.reject(3).then(() => {}, () => {})`(將 fulfilled 為`undefined`)不同,`Promise.reject(3).finally(() => {})` 將被 rejected 為`3`。 -> **備註:** 在 finally 回呼中使用 throw(或回傳 rejected promise)會導致新的 promise 被 reject,reject 的原因則是呼叫 throw() 時所指定的值。 +> [!NOTE] +> 在 finally 回呼中使用 throw(或回傳 rejected promise)會導致新的 promise 被 reject,reject 的原因則是呼叫 throw() 時所指定的值。 ## 範例 diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/index.md b/files/zh-tw/web/javascript/reference/global_objects/promise/index.md index a8bf34a3ebfa46..98939a1a4df0ce 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Promise **`Promise`** 物件代表一個即將完成、或失敗的非同步操作,以及它所產生的值。 -> **備註:** 此條目為介紹 Promise 建構式。要瞭解 Promise 相關使用方式,請先參考[使用 Promise](/zh-TW/docs/Web/JavaScript/Guide/Using_promises)。Promise 建構式主要用於包裹尚未支援 Promise 的函式。 +> [!NOTE] +> 此條目為介紹 Promise 建構式。要瞭解 Promise 相關使用方式,請先參考[使用 Promise](/zh-TW/docs/Web/JavaScript/Guide/Using_promises)。Promise 建構式主要用於包裹尚未支援 Promise 的函式。 {{EmbedInteractiveExample("pages/js/promise-constructor.html")}} @@ -39,9 +40,11 @@ new Promise( /* executor */ function(resolve, reject) { ... } ); ![](https://cdn.rawgit.com/Vectaio/a76330b025baf9bcdf07cb46e5a9ef9e/raw/26c4213a93dee1c39611dcd0ec12625811b20a26/js-promise.svg) -> **備註:** 許多其他語言擁有機制用來惰性求值(lazy evaluation)及延遲(deferring)運算,它們也被稱作「promises」 — e.g. Scheme. 然而在 JavaScript 中 Promises 代表那些(已經)發生中(happening)的程序,它們可以繫結回呼函式。若你要找的是惰性求值表示式,考慮不帶參數的 [arrow function](/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions):`f = () => expression` 來建立惰性求值表示式,並透過 `f()` 進行求值. +> [!NOTE] +> 許多其他語言擁有機制用來惰性求值(lazy evaluation)及延遲(deferring)運算,它們也被稱作「promises」 — e.g. Scheme. 然而在 JavaScript 中 Promises 代表那些(已經)發生中(happening)的程序,它們可以繫結回呼函式。若你要找的是惰性求值表示式,考慮不帶參數的 [arrow function](/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions):`f = () => expression` 來建立惰性求值表示式,並透過 `f()` 進行求值. -> **備註:** 一個被實現或拒絕,但不處於 pending 的 promise 被稱作被解決(settled)。你也會見到使用解決(resolved)一詞來描述 promises — 這代表 promises 被實現(fulfilled)了。[States and fates](https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md) 這篇文章包含了更多 promises 的專有名詞。 +> [!NOTE] +> 一個被實現或拒絕,但不處於 pending 的 promise 被稱作被解決(settled)。你也會見到使用解決(resolved)一詞來描述 promises — 這代表 promises 被實現(fulfilled)了。[States and fates](https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md) 這篇文章包含了更多 promises 的專有名詞。 ## 屬性 diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.md b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.md index dc8f74d6adc313..195567b448744b 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.md @@ -7,7 +7,8 @@ slug: Web/JavaScript/Reference/Global_Objects/Promise/then **`then()`** 方法回傳一個 {{domxref("Promise")}} 物件。它接收兩個引數: `Promise` 在成功及失敗情況時的回呼函式。 -> **備註:** 如果有一個或兩個引數被省略,或為非函式(non-functions),則 `then` 將處於遺失 handler(s) 的狀態,但不會產生錯誤。若發起 `then` 之 `Promise` 採取了一個狀態(實現(`fulfillment)`或拒絕(`rejection))`而 `then` 沒有處理它的函式,一個不具有額外 handlers 的新 `Promise` 物件將被建立,單純採取原 `Promise` 其最終狀態。 +> [!NOTE] +> 如果有一個或兩個引數被省略,或為非函式(non-functions),則 `then` 將處於遺失 handler(s) 的狀態,但不會產生錯誤。若發起 `then` 之 `Promise` 採取了一個狀態(實現(`fulfillment)`或拒絕(`rejection))`而 `then` 沒有處理它的函式,一個不具有額外 handlers 的新 `Promise` 物件將被建立,單純採取原 `Promise` 其最終狀態。 ## 語法 diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/has/index.md b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.md index fba5d1c87eaa2c..6cf19c8b4190ba 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/set/has/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.md @@ -24,7 +24,8 @@ mySet.has(value); 回傳 `true` 如果給定值存在在 `Set` 物件中;反之回傳 `false`。 -> **備註:** 技術上來說,`has()` 使用了 [`sameValueZero`](/zh-TW/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) 算法來判斷給定元素的存在與否。 +> [!NOTE] +> 技術上來說,`has()` 使用了 [`sameValueZero`](/zh-TW/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) 算法來判斷給定元素的存在與否。 ## 範例 diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/index.md b/files/zh-tw/web/javascript/reference/global_objects/string/index.md index b9f538b89eabbb..0e3511d88b83a3 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/string/index.md @@ -54,7 +54,8 @@ String(thing) | `\u{X}` ... `\u{XXXXXX}` | unicode 代碼 {{experimental_inline}} | | `\xXX` | Latin-1 字元 | -> **備註:** 和其他語言不同,JavaScript 將單引號字串和雙引號字串是做相同;因此,上述的序列可以在單引號或雙引號中作用。 +> [!NOTE] +> 和其他語言不同,JavaScript 將單引號字串和雙引號字串是做相同;因此,上述的序列可以在單引號或雙引號中作用。 ### 長字面值字串 @@ -161,7 +162,8 @@ console.log(eval(s2.valueOf())); // 回傳數字 4 ## `String` 通用方法 -> **警告:** 字串通用方法是非標準化的、被棄用的,也有近期將被刪除的。 +> [!WARNING] +> 字串通用方法是非標準化的、被棄用的,也有近期將被刪除的。 The `String` 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: diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/localecompare/index.md b/files/zh-tw/web/javascript/reference/global_objects/string/localecompare/index.md index dccb0b7835b533..086052707a09e6 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/localecompare/index.md +++ b/files/zh-tw/web/javascript/reference/global_objects/string/localecompare/index.md @@ -56,7 +56,8 @@ localeCompare(compareString, locales, options) - 若為正數,表示 `referenceStr`在`compareString`以後 - 若回傳`0`,表示兩者相等 -> **警告:** 不要依靠特定的回傳值,例如 `-1` 或是 `1`! +> [!WARNING] +> 不要依靠特定的回傳值,例如 `-1` 或是 `1`! > > 正數或是負數的回傳值在不同的瀏覽器(也包誇同一瀏覽器但不同版本)之間有可能會有所不同。因為 W3C 規範僅要求值得正負而已。 > 也因此,某些瀏覽器可能會回傳 `-2` 、 `2` 甚至其他值。 diff --git a/files/zh-tw/web/javascript/reference/iteration_protocols/index.md b/files/zh-tw/web/javascript/reference/iteration_protocols/index.md index 87b8eb9443d661..36b83784c3b72c 100644 --- a/files/zh-tw/web/javascript/reference/iteration_protocols/index.md +++ b/files/zh-tw/web/javascript/reference/iteration_protocols/index.md @@ -67,7 +67,8 @@ slug: Web/JavaScript/Reference/Iteration_protocols
-> **備註:** 我們無法反射性的一眼看出一個特定的物件是否實作了迭代器協議,然而要建立一個同時滿足迭代器及可迭代協議的物件卻是相當容易(如下例所示)。範例的做法允許一個迭代器被各個預期其可迭代行為的語法所消費。因此很少有需要實作迭代器協議而沒有實作可迭代協議的情況。 +> [!NOTE] +> 我們無法反射性的一眼看出一個特定的物件是否實作了迭代器協議,然而要建立一個同時滿足迭代器及可迭代協議的物件卻是相當容易(如下例所示)。範例的做法允許一個迭代器被各個預期其可迭代行為的語法所消費。因此很少有需要實作迭代器協議而沒有實作可迭代協議的情況。 > > ```js > var myIterator = { diff --git a/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.md b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.md index ff20a96d07489d..4952768e411211 100644 --- a/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.md +++ b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.md @@ -207,7 +207,8 @@ let a, b; ({ a, b } = { a: 1, b: 2 }); ``` -> **備註:** 當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 `( ... )` 。 +> [!NOTE] +> 當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 `( ... )` 。 > > `{a, b} = {a: 1, b: 2}` 不是有效的獨立語法,因為左邊的 `{a, b}` 被視為程式碼區塊而非物件。 > @@ -295,7 +296,8 @@ drawChart({ }); ``` -> **備註:** 在上述函式 **`drawChart`** 中,左方之解構式被指派到一個空物件: `{size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}` 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 **`drawChart()`** 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。 +> [!NOTE] +> 在上述函式 **`drawChart`** 中,左方之解構式被指派到一個空物件: `{size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}` 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 **`drawChart()`** 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。 ### 巢狀物件或陣列的解構 diff --git a/files/zh-tw/web/javascript/reference/operators/index.md b/files/zh-tw/web/javascript/reference/operators/index.md index a3a45f4aee702d..8574b3f5c5dd44 100644 --- a/files/zh-tw/web/javascript/reference/operators/index.md +++ b/files/zh-tw/web/javascript/reference/operators/index.md @@ -122,7 +122,8 @@ slug: Web/JavaScript/Reference/Operators - {{jsxref("Operators/Comparison_Operators", ">=", "#Greater_than_or_equal_operator")}} - : 大於等於運算子。 -> **備註:** => is not an operator, but the notation for [Arrow functions](/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions). +> [!NOTE] +> => is not an operator, but the notation for [Arrow functions](/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions). ### 相等運算子 diff --git a/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.md b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.md index 8c449ca3b21f95..171f9b4e980ed1 100644 --- a/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.md +++ b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.md @@ -57,7 +57,8 @@ let nestedProp = temp === null || temp === undefined ? undefined : temp.second; let result = someInterface.customMethod?.(); ``` -> **備註:** 假如物件有同樣的屬性名稱,而不是一個方法,使用 `?.` 將會抛出 {{JSxRef("TypeError")}} 錯誤(`x.y 不是一個函數`)。 +> [!NOTE] +> 假如物件有同樣的屬性名稱,而不是一個方法,使用 `?.` 將會抛出 {{JSxRef("TypeError")}} 錯誤(`x.y 不是一個函數`)。 #### 處理回呼函式或事件處理器 diff --git a/files/zh-tw/web/javascript/reference/operators/this/index.md b/files/zh-tw/web/javascript/reference/operators/this/index.md index d73547be139d6d..9efea4b670cdde 100644 --- a/files/zh-tw/web/javascript/reference/operators/this/index.md +++ b/files/zh-tw/web/javascript/reference/operators/this/index.md @@ -68,7 +68,8 @@ f2() === undefined; //true 所以在嚴格模式下,如果 `this` 沒有定義到執行環境內,其預設值就會是 `undefined`。 -> **備註:** 在第二個例子裡面,`this` 應為 [`undefined`](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/undefined),因為 `f2` 是直接被呼叫,而不是在其為某個物件的方法或屬性的情況下(例如 `window.f2()`)被直接呼叫。某些瀏覽器首次支援[嚴格模式](/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode)時沒導入這個特徵,它們會因此錯誤的回傳 `window` 物件。 +> [!NOTE] +> 在第二個例子裡面,`this` 應為 [`undefined`](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/undefined),因為 `f2` 是直接被呼叫,而不是在其為某個物件的方法或屬性的情況下(例如 `window.f2()`)被直接呼叫。某些瀏覽器首次支援[嚴格模式](/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode)時沒導入這個特徵,它們會因此錯誤的回傳 `window` 物件。 要從某個語境訪問另一個 `this` 語境的值,請使用 [call](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/call) 或 [apply](/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/apply): @@ -146,7 +147,8 @@ var foo = () => this; console.log(foo() === globalObject); // true ``` -> **備註:** 如果這參數被傳遞給箭頭函式的 call, bind, apply 調用,該參數會被忽略。你仍然可以將參數預先調用到 call,但第一個參數(thisArg)必須設置為空。 +> [!NOTE] +> 如果這參數被傳遞給箭頭函式的 call, bind, apply 調用,該參數會被忽略。你仍然可以將參數預先調用到 call,但第一個參數(thisArg)必須設置為空。 ```js // 作為物件的方法呼叫 @@ -276,7 +278,8 @@ console.log(o.average, o.sum); // logs 2, 6 若函式以建構子的身份呼叫(使用 [`new`](/zh-TW/docs/Web/JavaScript/Reference/Operators/new) 關鍵字) `this` 會和被建構的新物件綁定。 -> **備註:** 建構子預設透過 `this` 回傳該物件的參照,但它其實能回傳其他物件。如果回傳值不是物件的話,就會回傳 `this` 這個物件。 +> [!NOTE] +> 建構子預設透過 `this` 回傳該物件的參照,但它其實能回傳其他物件。如果回傳值不是物件的話,就會回傳 `this` 這個物件。 ```js /* diff --git a/files/zh-tw/web/javascript/reference/operators/typeof/index.md b/files/zh-tw/web/javascript/reference/operators/typeof/index.md index c6db499a7980f7..8570074c9ca69c 100644 --- a/files/zh-tw/web/javascript/reference/operators/typeof/index.md +++ b/files/zh-tw/web/javascript/reference/operators/typeof/index.md @@ -108,7 +108,8 @@ typeof null === "object"; // 自從有 JavaScript 開始就是這樣了 這個問題已計畫[在下一版 ECMAScript 予以修正](http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null) (會以 opt-in 方式提供). 屆時它將會做出如 `typeof null === 'null'` 的正確回傳結果。 -> **備註:** 此修正計畫已被拒絕 +> [!NOTE] +> 此修正計畫已被拒絕 ### 正規表示式 (Regular expressions) @@ -125,7 +126,8 @@ typeof /s/ === "object"; // Firefox 5+ ... // 符合 ECMAScript 5.1 在 IE 6, 7 和 8, `typeof alert === 'object'` -> **備註:** 這並不怪異。這是實情。在許多較舊的 IE 中, 主機端物件的確是物件, 而非函數 +> [!NOTE] +> 這並不怪異。這是實情。在許多較舊的 IE 中, 主機端物件的確是物件, 而非函數 ## 規範 diff --git a/files/zh-tw/web/javascript/reference/statements/async_function/index.md b/files/zh-tw/web/javascript/reference/statements/async_function/index.md index e0053108d6d64d..ac73d4d4b9db60 100644 --- a/files/zh-tw/web/javascript/reference/statements/async_function/index.md +++ b/files/zh-tw/web/javascript/reference/statements/async_function/index.md @@ -72,7 +72,8 @@ add2(10).then((v) => { }); ``` -> **警告:** 不要誤解 `Promise.all` 的 `await` +> [!WARNING] +> 不要誤解 `Promise.all` 的 `await` > > 在 `add1` 裡,該執行為了第一個 `await` 而暫停了兩秒,接著為了第二個 `await` 又暫停了兩秒。在第一個計時器(timer)被觸發前,第二個計時器並不會被建立。而在 `add2` 裡,兩個計時器都被建立起來、也都執行 `await` 過了。這把它帶往了 resolve 所的 2 秒暫停、而不是 4 秒暫停。然而這兩個 `await` 呼叫都在連續運行,而非平行運行。`await` **並不是** `Promise.all` 的自動程式。如果你想讓兩個、甚至兩個以上的 `await` promises 同時執行(in parallel),你必須使用 `Promise.all`. diff --git a/files/zh-tw/web/javascript/reference/statements/for...in/index.md b/files/zh-tw/web/javascript/reference/statements/for...in/index.md index 3699d0982229e2..9b928d57a5d8ac 100644 --- a/files/zh-tw/web/javascript/reference/statements/for...in/index.md +++ b/files/zh-tw/web/javascript/reference/statements/for...in/index.md @@ -45,7 +45,8 @@ for (變數 in 物件) {... A `for...in` loop iterates over the properties of an object in an arbitrary order (see the [delete operator](/zh-TW/docs/JavaScript/Reference/Operators/delete#Cross-browser_issues) 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. -> **備註:** If you only want to consider properties attached to the object itself, and not its prototypes, use [getOwnPropertyNames](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) or perform a [hasOwnProperty](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) check ([propertyIsEnumerable](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable) 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. +> [!NOTE] +> If you only want to consider properties attached to the object itself, and not its prototypes, use [getOwnPropertyNames](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) or perform a [hasOwnProperty](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) check ([propertyIsEnumerable](/zh-TW/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable) 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. > **備註:** `for..in` 不應該用來迭代一個索引順序很重要的[陣列](/zh-TW/docs/JavaScript/Reference/Global_Objects/Array)。 陣列索引只是以整數命名的可列舉屬性,其他方面等同於一般物件屬性。 無法擔保 `for...in` 以特定順序傳回索引,並且它將傳回全部可列舉屬性,包括非整數名的,以及繼承而來的可列舉屬性。因為迭代的順序依賴於 JavaScript 引擎的實作,在不同引擎下,迭代一個陣列可能不是以一個一致的順序存取陣列元素。因此,當你迭代陣列,且該陣列的存取順序很重要時,最好是使用以數值索引的 [for](/zh-TW/docs/JavaScript/Reference/Statements/for) 迴圈 (或 [Array.forEach](/zh-TW/docs/JavaScript/Reference/Global_Objects/Array/forEach) 或非標準 [`for...of`](/zh-TW/docs/JavaScript/Reference/Statements/for...of) 迴圈)。 diff --git a/files/zh-tw/web/javascript/reference/statements/for...of/index.md b/files/zh-tw/web/javascript/reference/statements/for...of/index.md index 366b3363340278..377e813a3d16ab 100644 --- a/files/zh-tw/web/javascript/reference/statements/for...of/index.md +++ b/files/zh-tw/web/javascript/reference/statements/for...of/index.md @@ -49,7 +49,8 @@ for (let value of iterable) { // 31 ``` -> **備註:** 每次迭代都會創建一個新的變數。在迴圈主體內重新賦值不會影響可迭代物件(在本例中是一個陣列)中的原始值。 +> [!NOTE] +> 每次迭代都會創建一個新的變數。在迴圈主體內重新賦值不會影響可迭代物件(在本例中是一個陣列)中的原始值。 你可以使用[解構賦值](/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)指派多個局部變數,或者使用屬性訪問子(如 `for (x.y of iterable)`)賦值給物件屬性。 diff --git a/files/zh-tw/web/javascript/reference/statements/label/index.md b/files/zh-tw/web/javascript/reference/statements/label/index.md index 0cea4aa923f043..cfc7fe05db17a2 100644 --- a/files/zh-tw/web/javascript/reference/statements/label/index.md +++ b/files/zh-tw/web/javascript/reference/statements/label/index.md @@ -9,7 +9,8 @@ slug: Web/JavaScript/Reference/Statements/label {{EmbedInteractiveExample("pages/js/statement-label.html")}} -> **備註:** 標記的迴圈或程式碼區塊非常罕見。通常可以使用函式呼叫而不是使用迴圈跳轉。 +> [!NOTE] +> 標記的迴圈或程式碼區塊非常罕見。通常可以使用函式呼叫而不是使用迴圈跳轉。 ## 語法 diff --git a/files/zh-tw/web/javascript/reference/statements/return/index.md b/files/zh-tw/web/javascript/reference/statements/return/index.md index 484a769b6f24fd..15b053fa283325 100644 --- a/files/zh-tw/web/javascript/reference/statements/return/index.md +++ b/files/zh-tw/web/javascript/reference/statements/return/index.md @@ -60,7 +60,8 @@ a + b; 主控台會警告「unreachable code after return statement」(在 return 宣告後面有無法抵達的程式碼)。 -> **備註:** 從 Gecko 40 開始,如果主控台發現在 return 宣告後面有無法抵達的程式碼,就會顯示警告。 +> [!NOTE] +> 從 Gecko 40 開始,如果主控台發現在 return 宣告後面有無法抵達的程式碼,就會顯示警告。 要避免 ASI 問題,可以添加括號: diff --git a/files/zh-tw/web/javascript/reference/strict_mode/index.md b/files/zh-tw/web/javascript/reference/strict_mode/index.md index 89d89a32fbb53e..d7bc743116c62d 100644 --- a/files/zh-tw/web/javascript/reference/strict_mode/index.md +++ b/files/zh-tw/web/javascript/reference/strict_mode/index.md @@ -15,7 +15,8 @@ slug: Web/JavaScript/Reference/Strict_mode 參考 [過渡到嚴格模式](/zh-TW/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode),如果你希望將你的程式碼在 JavaScript 語法嚴格、語法受限下執行。 -> **備註:** 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. +> [!NOTE] +> 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. ## 用法 @@ -107,7 +108,8 @@ delete Object.prototype; // throws a TypeError 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: -> **備註:** This is no longer the case in ECMAScript 2015 ([Firefox bug 1041128](https://bugzil.la/1041128)). +> [!NOTE] +> This is no longer the case in ECMAScript 2015 ([Firefox bug 1041128](https://bugzil.la/1041128)). ```js "use strict"; diff --git a/files/zh-tw/web/manifest/index.md b/files/zh-tw/web/manifest/index.md index 24545c733b84f6..d3ed9619c2938d 100644 --- a/files/zh-tw/web/manifest/index.md +++ b/files/zh-tw/web/manifest/index.md @@ -107,7 +107,8 @@ Web app manifest 的部署只需要在 HTML 文件中的 [head](/zh-TW/docs/Web/ - `rtl`(右至左) - `auto`(讓瀏覽器根據 Unicode 雙向演算法對書寫方向做出最佳的猜測) -> **備註:** 當省略其值時,預設為 `auto`。 +> [!NOTE] +> 當省略其值時,預設為 `auto`。 ### `display` @@ -126,7 +127,8 @@ Web app manifest 的部署只需要在 HTML 文件中的 [head](/zh-TW/docs/Web/ | `minimal-ui` | 這看起來和感覺上就像是獨立應用程式一樣,但將有控制導覽列 UI 元素的最小設置,元素會因瀏覽器而不同。 | `browser` | | `browser` | 預設值。 應用程式如常規般地被開啟於瀏覽器分頁或新視窗,依瀏覽器與平台而不同。 | (None) | -> **備註:** 你能根據顯示模式選擇性地將 CSS [display-mode](/docs/Web/CSS/@media/display-mode) media 功能運用於你的應用程式,這可以提供一致的使用者體驗不管是由網址開啟網站或者由桌面圖示啟動。 +> [!NOTE] +> 你能根據顯示模式選擇性地將 CSS [display-mode](/docs/Web/CSS/@media/display-mode) media 功能運用於你的應用程式,這可以提供一致的使用者體驗不管是由網址開啟網站或者由桌面圖示啟動。 ### `icons` @@ -205,7 +207,8 @@ Web app manifest 的部署只需要在 HTML 文件中的 [head](/zh-TW/docs/Web/ "prefer_related_applications": false ``` -> **備註:** 當省略其值時,預設為 `false。` +> [!NOTE] +> 當省略其值時,預設為 `false。` ### `related_applications` diff --git a/files/zh-tw/web/opensearch/index.md b/files/zh-tw/web/opensearch/index.md index 076fb8b1902b47..d11087715aa96d 100644 --- a/files/zh-tw/web/opensearch/index.md +++ b/files/zh-tw/web/opensearch/index.md @@ -50,7 +50,8 @@ OpenSearch 描述檔能[從網頁安裝搜尋模組](#自動測知搜尋模組) Firefox caches the icon as a [base64](https://en.wikipedia.org/wiki/Base64) `data:` URI (search plug-ins are stored in the profile's "searchplugins" folder). `http:` URIs are changed to `data:` URIs when this is done. - > **備註:** For icons loaded remotely (i.e. from `https://` URIs as opposed to `data:` URIs), Firefox will reject icons larger than 10 kilobytes in size. + > [!NOTE] + > For icons loaded remotely (i.e. from `https://` URIs as opposed to `data:` URIs), Firefox will reject icons larger than 10 kilobytes in size. ![Search suggestions from Google displayed in Firefox's search box](searchsuggestionsample.png) @@ -72,7 +73,8 @@ OpenSearch 描述檔能[從網頁安裝搜尋模組](#自動測知搜尋模組) - : 搜尋網站的網址,提供 Firefox 使用者不搜尋、直接連到搜尋網站的方法。 - > **備註:** 由於此元素非 OpenSearch 標準規格而是 Firefox 獨有,故加上「`moz:`」名稱空間,已確保不支援的用戶端能直接跳過此元素。 + > [!NOTE] + > 由於此元素非 OpenSearch 標準規格而是 Firefox 獨有,故加上「`moz:`」名稱空間,已確保不支援的用戶端能直接跳過此元素。 ## 自動測知搜尋模組 @@ -126,7 +128,8 @@ OpenSearch 描述檔能[從網頁安裝搜尋模組](#自動測知搜尋模組) template="http://example.com/mysearchdescription.xml" /> ``` -> **備註:** 目前的 [addons.mozilla.org](https://addons.mozilla.org)(AMO)不支援自動更新 OpenSearch 套件。如果要把搜尋套件放到 AMO,請不要用上自動更新的功能。 +> [!NOTE] +> 目前的 [addons.mozilla.org](https://addons.mozilla.org)(AMO)不支援自動更新 OpenSearch 套件。如果要把搜尋套件放到 AMO,請不要用上自動更新的功能。 ## 除錯技巧 diff --git a/files/zh-tw/web/security/mixed_content/index.md b/files/zh-tw/web/security/mixed_content/index.md index 2db8de2dcfca68..5b319ab37c4c73 100644 --- a/files/zh-tw/web/security/mixed_content/index.md +++ b/files/zh-tw/web/security/mixed_content/index.md @@ -60,7 +60,8 @@ Firefox 網頁主控台會在網站含有混合內容時,於「網路」標籤 要修正這個錯誤,就要移除所有的 HTTP 請求、並以 HTTPS 取代之。部份例子包含 JavaScript 檔案、CSS 樣式表、影像檔、影片檔或是其他多媒體文件。 -> **備註:** Firefox 55 以後,在本機端會允許混合內容的載入(請參見 [Firefox bug 903966](https://bugzil.la/903966))。 +> [!NOTE] +> Firefox 55 以後,在本機端會允許混合內容的載入(請參見 [Firefox bug 903966](https://bugzil.la/903966))。 ## 參見 diff --git a/files/zh-tw/web/security/same-origin_policy/index.md b/files/zh-tw/web/security/same-origin_policy/index.md index 1bb0a25efaddf7..4266c417c6303d 100644 --- a/files/zh-tw/web/security/same-origin_policy/index.md +++ b/files/zh-tw/web/security/same-origin_policy/index.md @@ -35,7 +35,8 @@ document.domain = "company.com"; 任何變更 document.domain 行為,包括 document.domain = document.domain 都會導致埠號重置為 null,因此無法只藉由執行 document.domain = "company.com" 讓 company.com:8080 和 company.com 互動,必須兩邊都重新設定好讓埠號都一致重置為 null。 -> **備註:** 為了讓子網域可以安全的存取其母網域,我們需要一起改變子、母網域的 document.domain 為相同值,即使只是將母網域設回原始值也是必要,否則將會導致許可權錯誤 (Permission Error)。 +> [!NOTE] +> 為了讓子網域可以安全的存取其母網域,我們需要一起改變子、母網域的 document.domain 為相同值,即使只是將母網域設回原始值也是必要,否則將會導致許可權錯誤 (Permission Error)。 ## 跨來源網路存取 diff --git a/files/zh-tw/web/svg/tutorial/fills_and_strokes/index.md b/files/zh-tw/web/svg/tutorial/fills_and_strokes/index.md index 9ed1d66d9680a5..5e209c09f41ebe 100644 --- a/files/zh-tw/web/svg/tutorial/fills_and_strokes/index.md +++ b/files/zh-tw/web/svg/tutorial/fills_and_strokes/index.md @@ -23,7 +23,8 @@ slug: Web/SVG/Tutorial/Fills_and_Strokes 此外,在 SVG 中你可以分别定义填充色和边框色的透明度,它们分别由 `fill-opacity` 和 `stroke-opacity` 两个属性控制。 -> **備註:** FireFox 3+支持 rgba 值,并且能够提供同样的效果,但是为了在其他浏览器中保持兼容,最好将它和边框/填充的透明度分开使用。如果同时定义了 rgba 值和透明度,它们将被一起调用。 +> [!NOTE] +> FireFox 3+支持 rgba 值,并且能够提供同样的效果,但是为了在其他浏览器中保持兼容,最好将它和边框/填充的透明度分开使用。如果同时定义了 rgba 值和透明度,它们将被一起调用。 ### 边框 diff --git a/files/zh-tw/web/svg/tutorial/gradients/index.md b/files/zh-tw/web/svg/tutorial/gradients/index.md index b755272af317b8..41c0a8277d91fc 100644 --- a/files/zh-tw/web/svg/tutorial/gradients/index.md +++ b/files/zh-tw/web/svg/tutorial/gradients/index.md @@ -68,7 +68,8 @@ Linear gradients change along a straight line. To insert one, you create a {{SVG ``` -> **備註:** 你也可以在漸變中使用`xlink:href`屬性,它可以將一個漸變的屬性和 stop 節點,引入到另一個漸變中。在下面的例子裡,我們就不需要在 Gradient2 裡重新創建許多 stop 節點。 +> [!NOTE] +> 你也可以在漸變中使用`xlink:href`屬性,它可以將一個漸變的屬性和 stop 節點,引入到另一個漸變中。在下面的例子裡,我們就不需要在 Gradient2 裡重新創建許多 stop 節點。 > > ```xml > diff --git a/files/zh-tw/web/svg/tutorial/index.md b/files/zh-tw/web/svg/tutorial/index.md index ba4af3b5bcd1b0..75a34d63c5da6e 100644 --- a/files/zh-tw/web/svg/tutorial/index.md +++ b/files/zh-tw/web/svg/tutorial/index.md @@ -9,7 +9,8 @@ slug: Web/SVG/Tutorial 本教學之目標在解釋 SVG 內部的技術細節。如果你只是想要畫出漂亮的圖形,你可以在 [Inkscape 的文件頁面](http://inkscape.org/doc/)上找到更多有用的資源。或是看看另一個好的 SVG 介绍:[W3C 的 SVG 入門](http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html)。 -> **備註:** 本教學文件還在初期階段,如果你有能力,可以來增加擴展一兩段,寫一整頁的话會更好! +> [!NOTE] +> 本教學文件還在初期階段,如果你有能力,可以來增加擴展一兩段,寫一整頁的话會更好! ##### 從頭介紹 SVG diff --git a/files/zh-tw/web/svg/tutorial/paths/index.md b/files/zh-tw/web/svg/tutorial/paths/index.md index 3a5d0ccf56ff48..d86f0b9df34342 100644 --- a/files/zh-tw/web/svg/tutorial/paths/index.md +++ b/files/zh-tw/web/svg/tutorial/paths/index.md @@ -173,7 +173,8 @@ T x y (or t dx dy) This shortcut looks at the previous control point you used and infers a new one from it. This means that after your first control point, you can make fairly complex shapes by specifying only end points. -> **備註:** This only works if the previous command was a Q or a T command. If it is not, then the control point is assumed to be the same as the previous point, and you'll only draw lines. +> [!NOTE] +> This only works if the previous command was a Q or a T command. If it is not, then the control point is assumed to be the same as the previous point, and you'll only draw lines. ![Shortcut_Quadratic_Bezier_with_grid.png](shortcut_quadratic_b%C3%A9zier_with_grid.png)