Back to Home

Introduction: callbacks

Many functions are provided by JavaScript host environments that allow you to schedule asynchronous actions. In other words, actions that we initiate now, but they finish later. For instance, one such function is the setTimeout function. There are other real-world examples of asynchronous actions, e.g. loading scripts and modules (we’ll cover them in later chapters). Take a look at the function loadScript(src), that loads a script with the given src: It inserts into the document a new, dynamically created, tag