button のクリックイベントに updateButtons(); を入れるのはなぜですか?

currentIndex の値が更新されるたびに updateButtons を呼ぶ必要があるからです。
2022年10月17日
ユーザー
function setupDots() {
    for (let i = 0; i < slides.length; i++) {
      const button = document.createElement('button');
      button.addEventListener('click', () => {
        currentIndex = i;
        dots.forEach(dot => {
          dot.classList.remove('current');
        });
        dots[currentIndex].classList.add('current');
        updateButtons();
        moveSlides();
      });

この updateButtons(); は何故必要なのでしょうか?
ここでは &laquo;と&raquo; の表示、非表示を設定していると認識しているのですが、 button になぜ必要なのかわかりません。

この回答を見るにはプレミアムプランへの登録が必要です

プレミアムプランとは?