Skip to content

Commit a55f4ad

Browse files
committed
Translation zh-TW answer 105
1 parent 7132b39 commit a55f4ad

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

zh-TW/README_zh-TW.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,4 +3336,43 @@ Promise.resolve(5)
33363336

33373337
</p>
33383338
</details>
3339+
---
3340+
3341+
###### 105. 將會輸出什麽內容?
3342+
3343+
```javascript
3344+
function compareMembers(person1, person2 = person) {
3345+
if (person1 !== person2) {
3346+
console.log("Not the same!")
3347+
} else {
3348+
console.log("They are the same!")
3349+
}
3350+
}
3351+
3352+
const person = { name: "Lydia" }
3353+
3354+
compareMembers(person)
3355+
```
3356+
3357+
- A: `Not the same!`
3358+
- B: `They are the same!`
3359+
- C: `ReferenceError`
3360+
- D: `SyntaxError`
3361+
3362+
<details><summary><b>答案</b></summary>
3363+
<p>
3364+
3365+
#### 答案: B
3366+
3367+
物件通過參考位址傳遞。當我們檢查物件的嚴格相等性(===)時,我們正在比較它們的參考位址。
3368+
3369+
我們將“person2”的預設值設置為“person”物件,並將“person”對像作為“person1”的值傳遞。
3370+
3371+
這意味著兩個值都引用內存中的同一位置,因此它們是相等的。
3372+
3373+
運行“ else”語句中的代碼塊,並記錄`They are the same!`
3374+
3375+
</p>
3376+
</details>
3377+
33393378
---

0 commit comments

Comments
 (0)