//二種類のイベントリスナーの登録法
let hoge = function(){/*処理*/};
element.addEventListner("type",()=>{ hoge(); });
element.addEventListner("type",hoge);
//上だと、関数が引数をとる場合にも書くことができ、より柔軟性が高い。
//例
element.addEventListner("type",()=>{ hoge("abc"); });
//setIntervalも同様
setInterval(()=>{hoge();},1000);
setInterval(hoge,1000);
setInterval(()=>{hoge("abc");},1000); //柔軟性が高い
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme