0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

イベントリスナーの登録法二種類

Posted at
//二種類のイベントリスナーの登録法

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); //柔軟性が高い
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?