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 --- .../reference/operators/destructuring_assignment/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-tw/web/javascript/reference/operators/destructuring_assignment') 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}); -
-

注意:當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 ( ... )

+
+

備註:當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 ( ... )

{a, b} = {a: 1, b: 2} 不是有效的獨立語法,因為左邊的 {a, b} 被視為程式碼區塊而非物件。

@@ -277,8 +277,8 @@ drawChart({ radius: 30 }); -
-

在上述函式 drawChart 中,左方之解構式被指派到一個空物件: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {} 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 drawChart() 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。

+
+

備註:在上述函式 drawChart 中,左方之解構式被指派到一個空物件: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {} 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 drawChart() 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。

巢狀物件或陣列的解構

-- cgit v1.2.3-54-g00ecf