Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 13
    But how is alerting or sending to console useful if you want to use the results in a different calculation, or store it in an object variable? Commented Mar 22, 2019 at 21:51
  • 3
    This is the most useful, quick and concise answer on the entire stackoverflow. Thanks. Commented May 31, 2021 at 13:22
  • 1
    The final code example shows the usage of another parameter - here src - that is not related with with the callback function and that is even inserted in code after the callback. Short and concise as Mastermind writes! Commented Mar 6, 2022 at 7:48
  • How do I know that img.onload=function(){.. is asynchronous when I maybe could rewrite it to function img.onload(){.. which is not possible but which seems synchronous. LIes it in the JS feeling that one should get after reading a lot of this shit? Commented Mar 6, 2022 at 8:15