16.13: async/await Part 1 - Topics of JavaScript/ES8

preview_player
Показать описание
This video covers the new ES8 "async” and “await” keywords for writing asynchronous functions in JavaScript.

Рекомендации по теме
Комментарии
Автор

@TheCodingTrain Daniel, beware that you properly return the expected Promise! At 4:50, your async function returns NOTHING, but the code executes anyway because the function does return a Promise internally. The issue you'd have is that the delay function gets's called, but if you expect to pass down a return value from the delay function, you would've lose that value, here. Unless the behavior is documented, you should return a value inside a promise chain.

It is also important to note that promises are also recursive (DFS)! And you can still chain a promise AFTER a catch handler.

yanfoo
Автор

The philosophical depth of those farewells where he says "see you in the next video, maybe, maybe not" is incredible.

braidata
Автор

-Await, delay, time.
Time....! (pause to ponder)
-Then I can return.
This is one of the most philosophically deep statements I've ever heard!
3:31

MichaelSeltenreich
Автор

After 10+ videos on Async/Await, this is the first one to really click for me. Thanks a bunch!

justenp
Автор

ur not boring like other I really like your video ur helpful thanks coding train (:

moulcode
Автор

yea, this is the best programming tutor hav met on youtube. Kip it up sir,

ndukwearmstrong
Автор

thank you for teaching to people who dont have money to pay a university you're helping many people like me

juliancaste
Автор

WE'RE @ ES8 ALREADY?!?!?!?!?!?! I'm not ready xD

Ranner
Автор

async/await are exactly what I have always wanted. Why didn’t I learn these earlier. Goodbye chains of 50 then

Caraxian
Автор

So many likes in every async await tutorial. So many people understanding; I feel totally left out

flanderstruck
Автор

Hi. A dumb question probably, how does js deals with different return values from different blocks (if, for, function) returns ?? Does the function not stops execution when it encounters a return statement ? Thanks

soufianta
Автор

is async and await the same as the ordinary callback function ?

Jason-ruxt
Автор

How many active timers can a Javascript program have? What if you need more than one? Btw- your tutorials are excellent!

lookalike
Автор

You were right, this does seem a lot nicer to me :)

offtheball
Автор

I think You are such an amazing person :) <3

FancyLillyChaan
Автор

I don't get how this works. DelayES8 function returns nothing, how can you call a function on it? Does await returns it behind the scenes?

melihcelik
Автор

Crikey, not sure whether I should spend the time learning promises or just move straight onto async/await =0

shadowalker
Автор

How about this:
async delayES8(time) {
try {
await delay(time);
createP('hello');
} catch (err) {
console.error(err);
}
}
Embed your .then, .catch into the async function.

robeSF
Автор

I like this a lot more than a bunch of thens.

kustomweb
Автор

I find it ironic that the modifier is "async" when what it effectively does is causes promises to operate synchronously... i.e. blocking. Or maybe I'm failing to understand. Keep up the great work!

ZombieBrainz