Why i am getting error while calling window onload function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why i am getting error while calling window onload function

window.onload = function start(){ //statement return xyz; } start();

26th Jan 2019, 6:35 AM
zexu knub
zexu knub - avatar
2 Answers
+ 2
You don't need to run the function manually (like you do in the last line of your code). The function is automatically triggered when the window finishes loading. Also, make sure xyz is defined.
26th Jan 2019, 7:08 AM
James
James - avatar
+ 1
James i want to use this function's variable to another function this was just an example
26th Jan 2019, 8:46 AM
zexu knub
zexu knub - avatar