2020年5月23日解決済み

this.spin()とspinの違いがわかりません

ユーザー
    spin() {
      this.img.src = this.getRandomImage();
      setTimeout(() => {
        this.spin();
      }, 50);
    }

constructour()内では、this spin(); とspin();にthisがつけられているのに対して、

 const spin = document.getElementById('spin');
  spin.addEventListener('click',() => {
    panels.forEach(panel =>{
      panel.spin();
    })
  });

constructor()外では、spinにthisがつけられていないことがわかりません。

スタッフ

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

プレミアムプランとは?