回答編集履歴
1
関数名が適当なので修正
test
CHANGED
@@ -16,13 +16,13 @@
|
|
16
16
|
|
17
17
|
const box = document.querySelector("#box");
|
18
18
|
|
19
|
-
setTimeout(function f
|
19
|
+
setTimeout(function flashText(pos = 1) {
|
20
20
|
|
21
21
|
if (pos === str.length + 1) return;
|
22
22
|
|
23
23
|
box.textContent = str.slice(0, pos++);
|
24
24
|
|
25
|
-
setTimeout(() => f
|
25
|
+
setTimeout(() => flashText(pos), 1000);
|
26
26
|
|
27
27
|
}, 1000);
|
28
28
|
|