回答編集履歴

1

関数名が適当なので修正

2018/11/09 14:19

投稿

root_jp
root_jp

スコア4666

test CHANGED
@@ -16,13 +16,13 @@
16
16
 
17
17
  const box = document.querySelector("#box");
18
18
 
19
- setTimeout(function foo(pos = 1) {
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(() => foo(pos), 1000);
25
+ setTimeout(() => flashText(pos), 1000);
26
26
 
27
27
  }, 1000);
28
28