1. Synchronization code

    Just like in today’s to-do list, the list uses a for loop

    Do two sets of maths papers first, then two sets of English papers…

  2. Asynchronous code

    Asynchronous code is finding out you don’t have your math test and asking your friend to bring it to you at home

    This request for help is like asynchronous code

    Certainly not the math exam, we don’t usually wait for the math exam to arrive and then do the math exam

    So we did the rest of the work, and I would wait until the math test came and then I would do the math test instead of waiting all the time

  3. Promise

    Synchronization is performed after asynchrony

    new Promise((resolve,reject) = > {
        resolve("Your best friend gets your math test!");
    }).then(res= >{
        console.log("I started to work on the math paper.");
    },err= > {
        console.log("I had to go home and get my math paper and do my math paper.");
    })
    Copy the code