Skip to content

Commit 819dcf3

Browse files
committed
Translation zh-TW answer 67
1 parent 1ac33f4 commit 819dcf3

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

zh-TW/README_zh-TW.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,10 +2086,10 @@ class Labrador extends Dog {
20862086
- C: 3
20872087
- D: 4
20882088

2089-
<details><summary><b>Answer</b></summary>
2089+
<details><summary><b>答案</b></summary>
20902090
<p>
20912091

2092-
#### Answer: B
2092+
#### 答案: B
20932093

20942094
在子類別中,在呼叫 `super` 前不能存取 `this` 關鍵字,如果你這麼做,它將拋出一個 `ReferenceError`,建構式1與4會引發這個錯誤。
20952095

@@ -2101,3 +2101,35 @@ class Labrador extends Dog {
21012101
</details>
21022102

21032103
---
2104+
2105+
###### 67. 將會輸出什麽內容?
2106+
2107+
```javascript
2108+
// index.js
2109+
console.log('running index.js');
2110+
import { sum } from './sum.js';
2111+
console.log(sum(1, 2));
2112+
2113+
// sum.js
2114+
console.log('running sum.js');
2115+
export const sum = (a, b) => a + b;
2116+
```
2117+
2118+
- A: `running index.js`, `running sum.js`, `3`
2119+
- B: `running sum.js`, `running index.js`, `3`
2120+
- C: `running sum.js`, `3`, `running index.js`
2121+
- D: `running index.js`, `undefined`, `running sum.js`
2122+
2123+
<details><summary><b>答案</b></summary>
2124+
<p>
2125+
2126+
#### 答案: B
2127+
2128+
`import` 命令是 _編譯階段_ 執行的。這代表被引入的模組會優先執行,而引入模組的檔案會 _之後執行_
2129+
2130+
這是 `CommonJS``require()``import` 之間的區別!使用 `require()`,您可以在執行程式時根據需要戴入依賴的項目。如果我們使用 `require` 而不是 `import` 來執行此題, 結果將會依 `running index.js``running sum.js``3` 的順序輸出。
2131+
2132+
</p>
2133+
</details>
2134+
2135+
---

0 commit comments

Comments
 (0)