Javascript Promises in 10 Minutes

  Рет қаралды 4,898

DevSage

DevSage

Күн бұрын

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 7 ай бұрын
I love your tutorials, you are truly a life savior!
@DevSage
@DevSage 2 ай бұрын
Glad you like them!
@scottamolinari
@scottamolinari 5 жыл бұрын
Now to explain async and await! Which is the better alternative to promises with ES6.
@sergiyrudenko905
@sergiyrudenko905 5 жыл бұрын
Thanks!!! The best explanation, even better that on MDN web docs!!! How long you bin doing programming? Do you have blog?
@DevSage
@DevSage 5 жыл бұрын
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.
@alissonsouza9278
@alissonsouza9278 5 жыл бұрын
Great!
@DevSage
@DevSage 5 жыл бұрын
Thanks!
Javascript Hoisting Explained
4:37
DevSage
Рет қаралды 3,8 М.
JavaScript Debouncing Explained Simply
16:04
DevSage
Рет қаралды 8 М.
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 38 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 49 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
ES6 Rest & Spread Explained Simply
9:03
DevSage
Рет қаралды 1,1 М.
Best Javascript Recursion Explanation on YouTube
10:38
DevSage
Рет қаралды 143 М.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 75 М.
A Simpler Way to See Results
19:17
Logan Smith
Рет қаралды 103 М.
JavaScript Closures Explained Simply
8:43
DevSage
Рет қаралды 6 М.
JavaScript Promises  -- Tutorial for Beginners
37:05
ColorCode
Рет қаралды 116 М.
Async JS Crash Course - Callbacks, Promises, Async Await
24:31
Traversy Media
Рет қаралды 1,4 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 38 МЛН