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