Compatible handling of event objects under Firefox

I talked about the event object yesterday,

function calc(event){
var event=event||window.event
console.log(event);

}

The encapsulated function where the parameter event is abbreviated as follows

function calc(e){
var event=e||window.event
console.log(event);

}

will report an error

提示,event is not defined 

So the solution is, don't shorthand.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324742381&siteId=291194637