Back to top
  • How JavaScript promises work

    Jeudi, 06 décembre 2018 06:00:00 De: Infoworld News

    Last week we looked at callbacks and promises. I made a case for using promises to easily coordinate asynchronous code. This week, we’ll dig further into understanding promises and look at the syntax.

    Imagine you have a box. You don’t know if there's anything in the box yet, but you can carry it around and say things about it, like:

    “This box is meant to have a gift inside.”
    “If the gift is in the box, I should tell everyone the gift is here.”
    “If the gift is in the box, I should also write a thank you note.”
    “If there’s a letter in the box saying the gift was out of stock, I should go order a different gift.”

    To read this article in full, please click here

    (Insider Story)
    Article complet à lire ici: How JavaScript promises work