js- event function calls to simplify

// general wording

function fn(event) {

  console.log(event)

}

div.onclick = function (event) {

  fn(event)

}

 

After simplifying ====== =====

function fn(event) {

  console.log(event)

}

div.onclick = fn

--------> below the same

div.onclick(function(event){

  console.log(event)  

})

Guess you like

Origin www.cnblogs.com/PasserByOne/p/12075229.html