I am starting my project but I would like to know how many times this function can be used to load several functions
window.addEventListener("load", function() {
alert("Hola");
});
without failing me.
I am starting my project but I would like to know how many times this function can be used to load several functions
window.addEventListener("load", function() {
alert("Hola");
});
without failing me.
The idea is that you don't use
window.addEventListener("load", function()
for every function you want to run.You can execute the functions you need within a single
window.addEventListener("load", function()
Example:
This fragment is only called once and that is when all external resources and the dom structure are ready.
It shouldn't affect performance the way it is.
could be the equivalent of
jquery
However, you should consider what you really want to do given that you have:
In any of the cases, if your function or functions do not depend on external files, they should work, since this call that you make is only made once, assigning it to the window object.