javascript - When one calls addEventListener without a target element what element does it default to? -


addeventlistener("load", run);  function run() {    //code } 

the above code appears work when try in web browser. guess because if 1 uses addeventlistener without target element defaults window object?

can confirm this?

global functions attached global object, window.

addeventlistener("load", run); 

is same as

window.addeventlistener("load", run); 

just alert same window.alert


Comments

Popular posts from this blog

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

matlab - error with cyclic autocorrelation function -

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -