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

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -