ahmtcn37 adlı üyeden alıntı: mesajı görüntüle
if(this.lastElementChild.classList.contains('fa-arrow-circle-down')){
      div.classList.remove('fa-arrow-circle-down');
    div.classList.add('fa-arrow-circle-up')
  }else{
      div.classList.remove('fa-arrow-circle-up ');
    div.classList.add('fa-arrow-circle-down')
  }
Bu şekilde dener misin
yukarıdaki şekilde de tam anlatmak istediğim şekilde çalışmadı contains sorgusuna veya operatörü ile up classını da ekleyince sorun çözüldü hocam yardımın için teşekkürler

for (var i = 0; i < buton.length; i++) {
  buton[i].onclick = function () {
    var panel = this.nextElementSibling;
    // this.lastElementChild.classList.toggle("fa-arrow-circle-up");
    if (
      panel.style.maxHeight &&
      (this.lastElementChild.classList.contains("fa-arrow-circle-down") ||
        this.lastElementChild.classList.contains("fa-arrow-circle-up"))
    ) {
      panel.style.maxHeight = null;
      this.lastElementChild.classList.remove("fa-arrow-circle-up");
      this.lastElementChild.classList.add("fa-arrow-circle-down");
    } else {
      panel.style.maxHeight = panel.scrollHeight + "px";
      this.lastElementChild.classList.remove("fa-arrow-circle-down");
      this.lastElementChild.classList.add("fa-arrow-circle-up");
    }
  };
}