From 3bb96c83e22a7a6214e79e9b903ee1c7b5657e67 Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:08 +0800 Subject: adjust dl/dt/dd tags for zh-TW --- .../equality_comparisons_and_sameness/index.html | 50 ++++++++-------------- files/zh-tw/web/javascript/index.html | 10 ----- .../web/javascript/reference/functions/index.html | 23 ---------- .../global_objects/array/copywithin/index.html | 9 ++-- .../global_objects/array/filter/index.html | 19 ++++---- .../reference/global_objects/array/index.html | 3 +- .../reference/global_objects/array/map/index.html | 1 - .../global_objects/array/slice/index.html | 10 +---- .../global_objects/array/splice/index.html | 4 +- .../object/defineproperties/index.html | 49 +++++++++------------ .../reference/global_objects/promise/index.html | 6 --- .../web/javascript/reference/operators/index.html | 3 -- .../reference/statements/async_function/index.html | 6 --- .../reference/statements/function_star_/index.html | 6 --- .../reference/statements/if...else/index.html | 7 --- .../web/javascript/reference/statements/index.html | 3 -- .../javascript/reference/statements/var/index.html | 3 -- 17 files changed, 56 insertions(+), 156 deletions(-) (limited to 'files') diff --git a/files/zh-tw/web/javascript/equality_comparisons_and_sameness/index.html b/files/zh-tw/web/javascript/equality_comparisons_and_sameness/index.html index ca2ce26b9a..1a5459883f 100644 --- a/files/zh-tw/web/javascript/equality_comparisons_and_sameness/index.html +++ b/files/zh-tw/web/javascript/equality_comparisons_and_sameness/index.html @@ -379,9 +379,6 @@ function attemptMutation(v)
- (unary negation)
-
- -

It's obvious that negating 0 produces -0. But the abstraction of an expression can cause -0 to creep in when you don't realize it. For example, consider:

@@ -389,36 +386,27 @@ function attemptMutation(v)

If obj.velocity is 0 (or computes to 0), a -0 is introduced at that place and propogates out into stoppingForce.

-
- -
-
Math.atan2
-
Math.ceil
-
Math.pow
-
Math.round
-
- -
+
+ Math.atan2, + Math.ceil, + Math.pow, + Math.round +
It's possible for a -0 to be introduced into an expression as a return value of these methods in some cases, even when no -0 exists as one of the parameters. E.g., using Math.pow to raise -Infinity to the power of any negative, odd exponent evaluates to -0. Refer to the documentation for the individual methods.
-
- -
-
Math.floor
-
Math.max
-
Math.min
-
Math.sin
-
Math.sqrt
-
Math.tan
-
- -
+
+ Math.floor, + Math.max, + Math.min, + Math.sin, + Math.sqrt, + Math.tan +
It's possible to get a -0 return value out of these methods in some cases where a -0 exists as one of the parameters. E.g., Math.min(-0, +0) evalutes to -0. Refer to the documentation for the individual methods.
-
- -
-
~
-
<<
-
>>
+
+ ~, + <<, + >> +
Each of these operators uses the ToInt32 algorithm internally. Since there is only one representation for 0 in the internal 32-bit integer type, -0 will not survive a round trip after an inverse operation. E.g., both Object.is(~~(-0), -0) and Object.is(-0 << 2 >> 2, -0) evaluate to false.
diff --git a/files/zh-tw/web/javascript/index.html b/files/zh-tw/web/javascript/index.html index d8b2bffb42..cc2b91de2e 100644 --- a/files/zh-tw/web/javascript/index.html +++ b/files/zh-tw/web/javascript/index.html @@ -42,27 +42,17 @@ translation_of: Web/JavaScript

JavaScript 指南

-
JavaScript 指南
更為詳細的 JavaScript 語言指南,供過去有 JavaScript 或其他語言的程式設計經驗的人看。
-
-
-

中階

客戶端 web APIs
在為網站或應用程序編寫客戶端JavaScript時,您將很快遇到應用程式介面(API)。 API是應用程式介面,用於操作運行站點的瀏覽器和操作系統的不同方面,或操縱來自其他網站或服務的資料。 在本單元中,我們將探討API是什麼,以及如何使用您在開發工作中經常遇到的一些最常見的API。 
-
- -
重新介紹 JavaScript
為了那些以為他們懂 JavaScript 的人寫的簡介。
-
- -
JavaScript 資料結構
簡介在 JavaScript 可用的資料結構。
相等值比較和相等度
diff --git a/files/zh-tw/web/javascript/reference/functions/index.html b/files/zh-tw/web/javascript/reference/functions/index.html index ce6646918f..0d64fa570a 100644 --- a/files/zh-tw/web/javascript/reference/functions/index.html +++ b/files/zh-tw/web/javascript/reference/functions/index.html @@ -74,14 +74,8 @@ function myFunc(theObject) {
name
The function name.
-
- -
param
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
- -
statements
The statements comprising the body of the function.
@@ -98,9 +92,6 @@ function myFunc(theObject) {
name
The function name. Can be omitted, in which case the function becomes known as an anonymous function.
-
- -
param
The name of an argument to be passed to the function. A function can have up to 255 arguments.
statements
@@ -123,14 +114,8 @@ function myFunc(theObject) {
name
The function name.
-
- -
param
The name of an argument to be passed to the function. A function can have up to 255 arguments.
-
- -
statements
The statements comprising the body of the function.
@@ -151,9 +136,7 @@ function myFunc(theObject) {
name
The function name. Can be omitted, in which case the function becomes known as an anonymous function.
-
-
param
The name of an argument to be passed to the function. A function can have up to 255 arguments.
statements
@@ -196,9 +179,6 @@ param => expression
arg1, arg2, ... argN
Zero or more names to be used by the function as formal argument names. Each must be a string that conforms to the rules for a valid JavaScript identifier or a list of such strings separated with a comma; for example "x", "theValue", or "a,b".
-
- -
functionBody
A string containing the JavaScript statements comprising the function definition.
@@ -227,9 +207,6 @@ param => expression
arg1, arg2, ... argN
Zero or more names to be used by the function as formal argument names. Each must be a string that conforms to the rules for a valid JavaScript identifier or a list of such strings separated with a comma; for example "x", "theValue", or "a,b".
-
- -
functionBody
A string containing the JavaScript statements comprising the function definition.
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html index 30520215e3..3e01759e87 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html @@ -30,14 +30,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/copyWithin
target
-
要複製序列(sequence)至該位置的索引(起始為 0)。若為負數,target 將會自陣列末項開始計算。
-
假如 target 大於等於 arr.length,則沒有項目會被複製。如果 target 的索引在 start 之後,則拷貝的序列將會被修剪以符合 arr.length
+
要複製序列(sequence)至該位置的索引(起始為 0)。若為負數,target 將會自陣列末項開始計算。假如 target 大於等於 arr.length,則沒有項目會被複製。如果 target 的索引在 start 之後,則拷貝的序列將會被修剪以符合 arr.length
start {{optional_inline}}
-
開始拷貝的起始元素索引(起始為 0)。若為負數,start 將會自陣列末項開始計算。
-
如果省略 startcopyWithin 將會自陣列首項開始複製(預設為 0)。
+
開始拷貝的起始元素索引(起始為 0)。若為負數,start 將會自陣列末項開始計算。如果省略 startcopyWithin 將會自陣列首項開始複製(預設為 0)。
end {{optional_inline}}
-
結束拷貝的結尾元素索引(起始為 0)。copyWithin 會拷貝至此索引,但不包含 end。若為負數,end 將會自陣列末項開始計算。
-
如果省略 endcopyWithin 將會一路拷貝至陣列末項(預設至 arr.length)。
+
結束拷貝的結尾元素索引(起始為 0)。copyWithin 會拷貝至此索引,但不包含 end。若為負數,end 將會自陣列末項開始計算。如果省略 endcopyWithin 將會一路拷貝至陣列末項(預設至 arr.length)。

回傳值

diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html index 49546e6505..ccaf9ad843 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html @@ -36,16 +36,15 @@ let longWords = words.filter(word => word.length > 6);
callback
-
此函式為一個斷言,用於測試陣列中的每個元素。回傳值為 true 時將當前的元素保留至新陣列中,若為 false 則不保留。可傳入三個參數:
-
-
-
element
-
原陣列目前所迭代處理中的元素。
-
index{{optional_inline}}
-
原陣列目前所迭代處理中的元素之索引。
-
array{{optional_inline}}
-
呼叫 filter 方法的陣列。
-
+
此函式為一個斷言,用於測試陣列中的每個元素。回傳值為 true 時將當前的元素保留至新陣列中,若為 false 則不保留。可傳入三個參數: +
+
element
+
原陣列目前所迭代處理中的元素。
+
index{{optional_inline}}
+
原陣列目前所迭代處理中的元素之索引。
+
array{{optional_inline}}
+
呼叫 filter 方法的陣列。
+
thisArg {{optional_inline}}
可選的。執行 callback 回呼函式的 this 值。
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 8417855923..f6c64c360c 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 @@ -111,8 +111,7 @@ new Array(arrayLength)
elementN
-
除了只傳遞一個參數給 Array 構造函數,且該參數為一個數字的情況(詳見下方的 arrayLength 參數),JavaScript 陣列會以傳入的元素進行初始化。
-
請注意,這種特殊情況僅適用於以 Array 構造函數建立的 JavaScript 陣列,而不適用於以括號語法建立的陣列常值(Array Literals)。
+
除了只傳遞一個參數給 Array 構造函數,且該參數為一個數字的情況(詳見下方的 arrayLength 參數),JavaScript 陣列會以傳入的元素進行初始化。請注意,這種特殊情況僅適用於以 Array 構造函數建立的 JavaScript 陣列,而不適用於以括號語法建立的陣列常值(Array Literals)。
arrayLength
如果傳遞給 Array 構造函數的唯一參數是 0 和 2^32 - 1(含)之間的整數,將回傳一個新的 JavaScript 陣列,其長度被設定為這個數字。如果參數是任何其他數值,將拋出 {{jsxref("RangeError")}} 異常。
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html index c87fa95064..96d5a81599 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html @@ -38,7 +38,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/map

callback 函式可傳入以下三個參數:

-
currentValue
原陣列目前所迭代處理中的元素。
index{{optional_inline}}
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html index 4512eecf4e..a4daba730b 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html @@ -24,15 +24,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/slice
begin {{optional_inline}}
-
自哪一個索引(起始為 0)開始提取拷貝。
-
可使用負數索引,表示由陣列的最末項開始提取。slice(-2) 代表拷貝陣列中的最後兩個元素。
-
假如 begin 為 undefined,則 slice 會從索引 0 開始提取。
+
自哪一個索引(起始為 0)開始提取拷貝。可使用負數索引,表示由陣列的最末項開始提取。slice(-2) 代表拷貝陣列中的最後兩個元素。假如 begin 為 undefined,則 slice 會從索引 0 開始提取。
end {{optional_inline}}
-
至哪一個索引(起始為 0)之前停止提取。slice 提取但不包含至索引 end
-
舉例來說,slice(1,4) 提取了陣列中第二個元素至第四個元素前為止(元素索引 1、2 以及 3)來拷貝。
-
可使用負數索引,表示由陣列的最末項開始提取。slice(2,-1) 代表拷貝陣列中第三個元素至倒數第二個元素。
-
若省略了 end,則 slice 會提取至陣列的最後一個元素(arr.length)。
-
假如 end 大於陣列的長度,slice 會提取至陣列的最後一個元素(arr.length)。
+
至哪一個索引(起始為 0)之前停止提取。slice 提取但不包含至索引 end。舉例來說,slice(1,4) 提取了陣列中第二個元素至第四個元素前為止(元素索引 1、2 以及 3)來拷貝。可使用負數索引,表示由陣列的最末項開始提取。slice(2,-1) 代表拷貝陣列中第三個元素至倒數第二個元素。若省略了 end,則 slice 會提取至陣列的最後一個元素(arr.length)。假如 end 大於陣列的長度,slice 會提取至陣列的最後一個元素(arr.length)。

回傳值

diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html index 2cb76617b8..77215cc1e1 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html @@ -26,9 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/splice
start
陣列中要開始改動的元素索引(起始為 0)。若索引大於陣列長度,則實際開始的索引值會被設為陣列長度。若索引為負,則會從陣列中最後一個元素開始往前改動(起始為 -1)且若其絕對值大於陣列的長度,則會被設為 0。
deleteCount {{optional_inline}}
-
一個表示欲刪除的原陣列元素數量的整數。
-
若省略了 deleteCount,或假如其值大於 array.length - start(也就是 deleteCount 大於 start 算起的剩餘元素數量),則所有從 start 開始到陣列中最後一個元素都會被刪除。
-
deleteCount 為 0 或是負數,則不會有元素被刪除。 因此,你應該給定至少一個欲加入的新元素(見下方說明)。
+
一個表示欲刪除的原陣列元素數量的整數。若省略了 deleteCount,或假如其值大於 array.length - start(也就是 deleteCount 大於 start 算起的剩餘元素數量),則所有從 start 開始到陣列中最後一個元素都會被刪除。若 deleteCount 為 0 或是負數,則不會有元素被刪除。 因此,你應該給定至少一個欲加入的新元素(見下方說明)。
item1, item2, ... {{optional_inline}}
start 開始,要加入到陣列的元素。 如果你沒有指定任何元素,則 splice() 只會依照 startdeleteCount 刪除陣列的元素。
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 23eb95a642..7739ab4bdd 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 @@ -17,34 +17,27 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties
obj
The object on which to define or modify properties.
props
-
An object whose own enumerable properties constitute descriptors for the properties to be defined or modified. Property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors (see {{jsxref("Object.defineProperty()")}} for more details). Descriptors have the following keys:
-
-
-
configurable
-
true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
- 預設為 false.
-
enumerable
-
若該屬性設為 true,則該屬性可被物件所列舉。
- 預設為 false.
-
- -
-
value
-
The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).
- 預設為 {{jsxref("undefined")}}.
-
writable
-
若該屬性為 true,則該屬性可透過{{jsxref("Operators/Assignment_Operators", "賦予運算子", "", 1)}}所改變
- 預設為 false.
-
- -
-
get
-
A function which serves as a getter for the property, or {{jsxref("undefined")}} if there is no getter. The function return will be used as the value of property.
- 預設為 {{jsxref("undefined")}}.
-
set
-
A function which serves as a setter for the property, or {{jsxref("undefined")}} if there is no setter. The function will receive as only argument the new value being assigned to the property.
- 預設為 {{jsxref("undefined")}}.
-
+
An object whose own enumerable properties constitute descriptors for the properties to be defined or modified. Property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors (see {{jsxref("Object.defineProperty()")}} for more details). Descriptors have the following keys: +
+
configurable
+
true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
+ 預設為 false.
+
enumerable
+
若該屬性設為 true,則該屬性可被物件所列舉。
+ 預設為 false.
+
value
+
The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).
+ 預設為 {{jsxref("undefined")}}.
+
writable
+
若該屬性為 true,則該屬性可透過{{jsxref("Operators/Assignment_Operators", "賦予運算子", "", 1)}}所改變
+ 預設為 false.
+
get
+
A function which serves as a getter for the property, or {{jsxref("undefined")}} if there is no getter. The function return will be used as the value of property.
+ 預設為 {{jsxref("undefined")}}.
+
set
+
A function which serves as a setter for the property, or {{jsxref("undefined")}} if there is no setter. The function will receive as only argument the new value being assigned to the property.
+ 預設為 {{jsxref("undefined")}}.
+
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 c14a429795..ec38359021 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 @@ -66,14 +66,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise
回傳一個 promise,當在引數 iterable 中所有 promises 都被實現時被實現,或在引數 iterable 中有一個 promise 被拒絕時立刻被拒絕。若回傳的 promise 被實現,它將以一個實現值的陣列被實現,其順序與 iterable 中的 promises 相同。若回傳的 promise 被拒絕,它將以失敗訊息被拒絕,此訊息來自第一個在 iterable 中被拒絕的 promise。這個方法在聚集許多 promises 的結果時很有效。
{{jsxref("Promise.race", "Promise.race(iterable)")}}
回傳一個被實現或拒絕的 promise,當 iterable 中有一個 promise 被實現或拒絕時。
-
- -
{{jsxref("Promise.reject", "Promise.reject(reason)")}}
回傳一個以失敗訊息拒絕的 promise
-
- -
{{jsxref("Promise.resolve", "Promise.resolve(value)")}}
回傳一個以 value 實現的 promise。若該值為 thenable (i.e. 具有 then 方法),回傳的 promise 將跟隨(follow)之,採用她的最終狀態; 在其他情形回傳的 promise 將以 value 被實現。一般來說,當您不知道 value 是否為 promise,使用 {{jsxref("Promise.resolve", "Promise.resolve(value)")}},將回傳值以 promise 作處理。
diff --git a/files/zh-tw/web/javascript/reference/operators/index.html b/files/zh-tw/web/javascript/reference/operators/index.html index e6efa9a181..6d27e8d2a5 100644 --- a/files/zh-tw/web/javascript/reference/operators/index.html +++ b/files/zh-tw/web/javascript/reference/operators/index.html @@ -115,9 +115,6 @@ translation_of: Web/JavaScript/Reference/Operators
乘法運算子。
{{jsxref("Operators/Arithmetic_Operators", "%", "#Remainder")}}
餘數運算子。
-
- -
{{jsxref("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}
指數運算子。
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 ced67f4a09..1111e54da6 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 @@ -29,14 +29,8 @@ translation_of: Web/JavaScript/Reference/Statements/async_function
name
函式名稱。
-
- -
param
傳遞至函式的參數名稱。
-
- -
statements
組成該函式主體的陳述。
diff --git a/files/zh-tw/web/javascript/reference/statements/function_star_/index.html b/files/zh-tw/web/javascript/reference/statements/function_star_/index.html index 11b1013537..58180049af 100644 --- a/files/zh-tw/web/javascript/reference/statements/function_star_/index.html +++ b/files/zh-tw/web/javascript/reference/statements/function_star_/index.html @@ -31,14 +31,8 @@ translation_of: Web/JavaScript/Reference/Statements/function*
name
函式名稱。
-
- -
param
要被傳入函式的引數名稱,一個函式最多可以擁有 255 個引數。
-
- -
statements
statements 構成了函式內容的陳述式。
diff --git a/files/zh-tw/web/javascript/reference/statements/if...else/index.html b/files/zh-tw/web/javascript/reference/statements/if...else/index.html index 8fea9e55f6..0546af300f 100644 --- a/files/zh-tw/web/javascript/reference/statements/if...else/index.html +++ b/files/zh-tw/web/javascript/reference/statements/if...else/index.html @@ -20,17 +20,10 @@ translation_of: Web/JavaScript/Reference/Statements/if...else
條件式
一個成立或不成立的運算式
-
- -
第一個陳述式(statement1)
如果if中的條件(conditions)為真時執行陳述式(statements)。陳述式可以為任何內容,包含巢狀式(nested)的if陳述。當要執行多行的陳述式(statements)時,使用區塊(block)將所要執行的陳述式包覆。如果不需要執行任何動作時,則不撰寫任何陳述式(empty statement)。
第二個陳述式(statement2)
-
- -
當件不成立時所執行的部份,當else被撰寫時才會被執行。可以是任何的陳述式,包含使用區塊(block)及巢狀(nested)的陳述。
-

描述

diff --git a/files/zh-tw/web/javascript/reference/statements/index.html b/files/zh-tw/web/javascript/reference/statements/index.html index 63c3483f1b..bed5469f55 100644 --- a/files/zh-tw/web/javascript/reference/statements/index.html +++ b/files/zh-tw/web/javascript/reference/statements/index.html @@ -90,9 +90,6 @@ translation_of: Web/JavaScript/Reference/Statements
Used to import functions exported from an external module, another script.
{{jsxref("Statements/label", "label")}}
Provides a statement with an identifier that you can refer to using a break or continue statement.
-
- -
{{deprecated_inline}} {{jsxref("Statements/with", "with")}}
Extends the scope chain for a statement.
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 1a085c5bd9..2ef07a3afa 100644 --- a/files/zh-tw/web/javascript/reference/statements/var/index.html +++ b/files/zh-tw/web/javascript/reference/statements/var/index.html @@ -14,9 +14,6 @@ translation_of: Web/JavaScript/Reference/Statements/var
varnameN
變數名稱。可以是任何合法的識別字符 (identifier)。
-
- -
valueN
變數的初始值。可以是任何合法的表示式 (expression)。
-- cgit v1.2.3-54-g00ecf