+ 2
Why I should call function at first;
This code I collected from w3School. can you tell me why function call at first? https://code.sololearn.com/W8NqXsSMIpkQ/?ref=app
4 ответов
+ 7
not necessary. you have delayed your JavaScript code till doc load. so just call the function after that, it will work.
does not matter if you call your function 1st or later try for yourself and see .
note: the function call must be inside the onload function else your call will come before your function is loaded.
+ 3
It ensures that Javascript works AFTER the HTML is loaded else it will produce an error not being able to find the tag you are asking for
0
In this case it doesn't matter where to call the function.
0
It’s not necessary to call function at first you can call at anytime