From f45e9e070c93ebbd83d488bdd775987a4d75c201 Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:08 +0800 Subject: fix yari h2m dry run errors --- .../javascript/reference/global_objects/array/foreach/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-tw/web/javascript/reference/global_objects/array/foreach') 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

forEach() does not mutate the array on which it is called (although callback, if invoked, may do so).

-
-

除非是拋出異常,否則並沒有中止 forEach() 迴圈的辦法。如果你需要這樣做,forEach() 就是錯誤的用法,相反的,應該要用簡單的迴圈。如果你要測試陣列裡面的元素並回傳布林值,可以用 {{jsxref("Array.prototype.every()", "every()")}} 或 {{jsxref("Array.prototype.some()", "some()")}}。如果可以的話,新的方法 {{jsxref("Array.prototype.find()", "find()")}} 或 {{jsxref("Array.prototype.findIndex()", "findIndex()")}} 也可以用於 true 值之後提前終止。

+
+

備註:除非是拋出異常,否則並沒有中止 forEach() 迴圈的辦法。如果你需要這樣做,forEach() 就是錯誤的用法,相反的,應該要用簡單的迴圈。如果你要測試陣列裡面的元素並回傳布林值,可以用 {{jsxref("Array.prototype.every()", "every()")}} 或 {{jsxref("Array.prototype.some()", "some()")}}。如果可以的話,新的方法 {{jsxref("Array.prototype.find()", "find()")}} 或 {{jsxref("Array.prototype.findIndex()", "findIndex()")}} 也可以用於 true 值之後提前終止。

範例

@@ -140,8 +140,8 @@ obj.sum;

Since the thisArg parameter (this) is provided to forEach(), it is passed to callback each time it's invoked, for use as its this value.

-
-

If passing the function argument using an arrow function expression the thisArg parameter can be omitted as arrow functions lexically bind the {{jsxref("Operators/this", "this")}} value.

+
+

Note: If passing the function argument using an arrow function expression the thisArg parameter can be omitted as arrow functions lexically bind the {{jsxref("Operators/this", "this")}} value.

An object copy function

-- cgit v1.2.3-54-g00ecf