Javascript Promises in 10 Minutes

Поділитися
Вставка
  • Опубліковано 11 лют 2019
  • What's a Promise?
    A Promise is an object that acts as a placeholder for some value or operation that is soon to complete or return. Promises are similar to callbacks in that they are both used to control the execution order of a program. If you have 2 asynchronous (not occuring in any particular order) events A and B, and you need to ENSURE that Event B begins ONLY AFTER Event A completes, you can wrap Event A with a Promise object. This promise executes Event A and then gives you the option to either 'resolve' or 'reject' the Promise.
    The Promise should be resolved if Event A was executed successfully with no errors. When a Promise is resolved, a special success callback function is triggered. This callback can execute Event B. A Promise should be rejected if Event A failed to complete successfully or produced an error. When a Promise is rejected, a special failure callback is triggered that can be used to carry out error handling tasks.
    🌎 Find Me Here:
    Twitter: / realdevsage
    Ebooks: payhip.com/devsage
    Discord: / discord
    Merch: cottonbureau.com/people/devsage

КОМЕНТАРІ • 8

  • @DevSage
    @DevSage  2 роки тому

    💙 Twitter: twitter.com/realDevSage
    📙 Ebooks: payhip.com/devsage
    💥 Discord: discord.gg/BP8wPv6raA

  • @Alexander-hi6qg
    @Alexander-hi6qg 5 місяців тому

    I love your tutorials, you are truly a life savior!

    • @DevSage
      @DevSage  8 днів тому +1

      Glad you like them!

  • @sergiyrudenko905
    @sergiyrudenko905 5 років тому +1

    Thanks!!! The best explanation, even better that on MDN web docs!!! How long you bin doing programming? Do you have blog?

    • @DevSage
      @DevSage  5 років тому +1

      I appreciate that. I've been coding for around 7 years now. I do have a blog but I don't really post on it a lot.

  • @scottamolinari
    @scottamolinari 5 років тому

    Now to explain async and await! Which is the better alternative to promises with ES6.

  • @alissonsouza9278
    @alissonsouza9278 5 років тому +1

    Great!