If you stick that at the bottom of your HTML, the code inside the load listener will run once, when the whole page has loaded (including resources such as images).
Yes the above load event works. Itβs not needed though, for all scripts on the page execute only once too. The usual rule of placing your script at the end of the body, just before the </body> tag also does the job, without needing the script to wait for the load event either.