File tree Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -2086,10 +2086,10 @@ class Labrador extends Dog {
2086
2086
- C: 3
2087
2087
- D: 4
2088
2088
2089
- <details ><summary ><b >Answer </b ></summary >
2089
+ <details ><summary ><b >答案 </b ></summary >
2090
2090
<p >
2091
2091
2092
- #### Answer : B
2092
+ #### 答案 : B
2093
2093
2094
2094
在子類別中,在呼叫 ` super ` 前不能存取 ` this ` 關鍵字,如果你這麼做,它將拋出一個 ` ReferenceError ` ,建構式1與4會引發這個錯誤。
2095
2095
@@ -2101,3 +2101,35 @@ class Labrador extends Dog {
2101
2101
</details >
2102
2102
2103
2103
---
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
+ ---
You can’t perform that action at this time.
0 commit comments