Combining Async Await with Promises

  Рет қаралды 7,427

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

6 жыл бұрын

Async and await can be combined and used with Promises but the results may sometimes be surprising.
This video looks at how you can effectively combine Async, await, and Promises.
It is important to remember that fetch( ) calls are also Promises.
Code GIST: gist.github.com/prof3ssorSt3v...

Пікірлер: 16
@bhavarkumavat3202
@bhavarkumavat3202 4 жыл бұрын
Simple & Clean === Quality === True (I speak JS 😇🤐) , Distributing knowledge is one of the best gifts and thing one can do. Thank You for teaching me these concepts
@rotrose7531
@rotrose7531 4 жыл бұрын
Thank you for another wonderful lesson. Many teacher just make this kind thing like a format, you are the first to explain what is happening inside and where the error comes from. Simply great.
@sidarjunful
@sidarjunful 3 жыл бұрын
Thanks for taking the time and making this awesome content, and making javascript wonderful to understand.
@chesterxp508
@chesterxp508 2 жыл бұрын
Another very cool tutorial!
@jaehyeokchoe6919
@jaehyeokchoe6919 6 жыл бұрын
Thank you for helpful contents! Someday please make a video introducing your development environment for the beginners :)
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 6 жыл бұрын
I make my videos using Brackets with the Emmets plugin. I have videos on both already. I demo most things in either Chrome or in the Terminal (Command Prompt). For things that require a web server, I use MAMP. I have a number of videos about aspects of MAMP too. Just do a search on my channel home page for "Brackets" and "Emmet" to start.
@bobobo1673
@bobobo1673 3 жыл бұрын
Interesting! Now I try to see how use asyn await and promise all together
@ironmanlifts
@ironmanlifts 4 жыл бұрын
Thanks great videos.
@user-oc9cf3vw8i
@user-oc9cf3vw8i 4 ай бұрын
@parthkumarchaudhary
@parthkumarchaudhary 4 жыл бұрын
Very Informative and great detailed oriented videos. can you suggest best resources to learn JS ?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
There are lots of great resources online. On KZbin Wes Bos, Brad Traversy, and Colt Steele are all really good.
@radoslavtsanev6822
@radoslavtsanev6822 4 жыл бұрын
So the main difference with regular Promise is that here we get the value of the promise and we don't need to use then? Also if I remove async and await and reject the promise in the delay function, when I log the Promise I get [[PromiseStatus]]: "resolved" - isn't that supposed to be rejected? Thank you
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
Effectively yes, we are removing the requirement for the then( ) by adding await. At 3:15 in the video you can see the delay function run without the await and it will contain Promise pending. ~1000ms later it will show rejected.
@radoslavtsanev6822
@radoslavtsanev6822 4 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Ok, I got it correctly. Thank you for your response!
@rishabhs
@rishabhs 5 жыл бұрын
why resolved promise has printed 42 at the end of the video? We passed ms as 1000 right?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 жыл бұрын
1000ms is the delay before the function resolve gets called. 42 is the value passed to the function resolve.
Build an Autocomplete Input with Debounce
15:42
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 7 М.
Intro to Async and Await
8:08
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 6 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 13 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 12 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 63 МЛН
Understanding the Keyword THIS in JavaScript
13:59
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 8 М.
Efficient ES6 async await with fetch
8:22
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 15 М.
JavaScript Promises  -- Tutorial for Beginners
37:05
ColorCode
Рет қаралды 113 М.
What are Callback Functions and How Do They Work?
9:44
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 31 М.
JavaScript ES6 Promises - Basic Syntax
12:08
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 25 М.
Async JS Crash Course - Callbacks, Promises, Async Await
24:31
Traversy Media
Рет қаралды 1,4 МЛН
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 13 МЛН