回答編集履歴
1
ミスがあったため修正。
answer
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
仕様です。
|
4
4
|
|
5
5
|
```js
|
6
|
-
function()
|
6
|
+
function test() {}
|
7
7
|
test(); // 実行
|
8
8
|
```
|
9
9
|
|
@@ -13,5 +13,16 @@
|
|
13
13
|
|
14
14
|
setTimeoutは第一引数に関数を渡します。
|
15
15
|
|
16
|
+
```js
|
17
|
+
function test() { console.log( 0 ) }
|
18
|
+
setTimeout( test, 1000 );
|
19
|
+
function test2() {
|
20
|
+
console.log( 1 )
|
21
|
+
return function() { console.log( 2 ) }
|
22
|
+
}
|
23
|
+
setTimeout( test2(), 1000 );
|
24
|
+
```
|
25
|
+
|
26
|
+
|
16
27
|
【WindowOrWorkerGlobalScope.setTimeout() - Web API | MDN】
|
17
28
|
[https://developer.mozilla.org/ja/docs/Web/API/WindowTimers/setTimeout](https://developer.mozilla.org/ja/docs/Web/API/WindowTimers/setTimeout)
|