No video

Javascript Promises in 10 Minutes

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

DevSage

DevSage

5 жыл бұрын

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 М.
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,8 МЛН
JavaScript Debouncing Explained Simply
16:04
DevSage
Рет қаралды 8 М.
Best Javascript Recursion Explanation on YouTube
10:38
DevSage
Рет қаралды 143 М.
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
Javascript - Create a Wrapper Class
7:02
DevSage
Рет қаралды 11 М.
JavaScript Promises  -- Tutorial for Beginners
37:05
ColorCode
Рет қаралды 116 М.
JavaScript this Keyword Explained Simply
11:42
DevSage
Рет қаралды 14 М.
Async JS Crash Course - Callbacks, Promises, Async Await
24:31
Traversy Media
Рет қаралды 1,4 МЛН
The Truth about Rust/WebAssembly Performance
29:47
Greg Johnston
Рет қаралды 177 М.
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 74 М.
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН