One of the major advantages of JavaScript is that everything is asynchronous. For the most part, different parts of your code don't affect the execution of others. doALongThing(() => console.log("I will be logged second!")); console.log("I will be logged first!"); Unfortunately, this is also one of