teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

let -> const

2020/05/18 17:36

投稿

satokei
satokei

スコア1217

answer CHANGED
@@ -10,8 +10,8 @@
10
10
  ];
11
11
 
12
12
  list.addEventListener('click', e => {
13
- let nowIndex = iconList.findIndex(icon => e.target.classList.contains(icon));
13
+ const nowIndex = iconList.findIndex(icon => e.target.classList.contains(icon));
14
- let nextIndex = (nowIndex + 1) % iconList.length;
14
+ const nextIndex = (nowIndex + 1) % iconList.length;
15
15
  e.target.classList.replace(iconList[nowIndex], iconList[nextIndex]);
16
16
  });
17
17
  ```