回答編集履歴
1
let -> const
test
CHANGED
@@ -22,9 +22,9 @@
|
|
22
22
|
|
23
23
|
list.addEventListener('click', e => {
|
24
24
|
|
25
|
-
|
25
|
+
const nowIndex = iconList.findIndex(icon => e.target.classList.contains(icon));
|
26
26
|
|
27
|
-
|
27
|
+
const nextIndex = (nowIndex + 1) % iconList.length;
|
28
28
|
|
29
29
|
e.target.classList.replace(iconList[nowIndex], iconList[nextIndex]);
|
30
30
|
|