JavaScript Async Await

JavaScript Async Await

Web Dev Simplified

5 лет назад

807,205 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Vski Developers
Vski Developers - 23.09.2023 21:54

Man, not to bad mouth fireship, buh i just came from one of his videos and i just couldn’t get a single thing he was saying 😭😭

Ответить
Luciano Classical Guitar
Luciano Classical Guitar - 14.09.2023 01:35

Now I am more confused lol

Ответить
Syed Salman
Syed Salman - 06.09.2023 21:59

Best explanation I've found and that too in only 7 minutes! You are amazing!

Ответить
Rodney Tapit
Rodney Tapit - 31.07.2023 06:41

Just the right measure of knowledge and example code to pass on the idea, thank you it's a very good tutorial.

Ответить
Tushar Singh
Tushar Singh - 29.07.2023 09:40

Thank You So Much BROTHER............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

Ответить
Predator
Predator - 25.07.2023 22:16

U made it confusing in the first part, i guess while making promises code, u could have done like this, it would have been better.
const makeRequest = (location) => {
return new Promise((resolve, reject) => {
console.log(`Making Request to ${location}`)
location === 'Google' ? resolve('Google says hi') : reject('We can only talk to Google')
})
}
const processRequest = (response) => {
return new Promise((resolve, reject) => {
console.log('Processing response')
resolve(`Extra Information + ${response}`)
})
}
makeRequest('Google').then((response) => {
console.log('Response Received')
return processRequest(response).then(
(response) => {
console.log(response)
}
)
}).catch(
(error) => {
console.log(error)
}
)
The reason I prefer this as in your code, you implemented the then of the second promise (makeRequest) outside the then of the first Promise(makeRequest), it works in this case as the second promise didnt have any reject scenario, but it would have been difficult to understand the reject scenario as in this case,
const CheckPositiveOrNegative = (num) =>{
console.log("Number received, Checking Positive or Negative")
return new Promise((resolve,reject)=>{
num > 0 ? resolve('Positive') : reject('Negative');
})
}
const CheckParity = (num) => {
console.log("Number received, Checking Parity")
return new Promise((resolve,reject)=>{
num % 2 === 0 ? resolve('Even') : reject('Odd');
})
}
CheckPositiveOrNegative(-9).then(
(result) =>{
console.log(result)
return CheckParity(-9).then(
(result) =>{
console.log(result);
}
).catch(
(error) =>{
console.log(error)
})
}
).catch(
(error) =>{
console.log(error)
return CheckParity(-9).then(
(error) =>{
console.log(error);
}
).catch(
(error) =>{
console.log(error)
})
}
)

Ответить
Chester XP
Chester XP - 21.07.2023 19:46

GoodJob!

Ответить
lightning emperor
lightning emperor - 10.07.2023 13:14

Hard names they give to simple things
I thought it will be hard LOL

Ответить
Sergei Kardashev
Sergei Kardashev - 08.07.2023 12:33

Thanks for the video. Please note that your cursor is nearly invisible.

Ответить
Ziya Gasimli
Ziya Gasimli - 10.06.2023 18:44

I watched about 10 videos, it's very diffucult topic to understand

Ответить
Paul Darby
Paul Darby - 18.05.2023 19:19

Almost perfect video. Just doesn't show what happens if the first promise takes a little while to resolve. I can work that out myself though. 👍

Ответить
Bill New, Sr.
Bill New, Sr. - 10.05.2023 02:12

Another fine video.

Subscribed to your channel now.

Thank you!

Ответить
Sabeen Sadaf
Sabeen Sadaf - 28.04.2023 16:46

can you please paste a link so we can see the example code that you are using in tutorial.

Ответить
Nirdesh
Nirdesh - 22.04.2023 15:01

Love you man

Ответить
mani raj
mani raj - 02.04.2023 15:46

How to use async await inside promise?

Ответить
iranRevolution
iranRevolution - 30.03.2023 15:45

thank you so much for teaching this stuff

Ответить
Surjendu Pal
Surjendu Pal - 18.03.2023 12:41

Thanks for this video. i think this is the most simplest and easily understandable video all over yt on async/await

Ответить
divya M
divya M - 28.02.2023 13:10

This is the first video of yours I am watching. trust me, I haven't subscribed to any other channel this fast

Ответить
WalpNacht
WalpNacht - 22.02.2023 13:59

i dont get why use async await when the code is so much longer

Ответить
Salaheddin AbuEin
Salaheddin AbuEin - 05.02.2023 08:50

Thank you very much.

Ответить
Default Profile
Default Profile - 05.02.2023 06:57

Goat

Ответить
zangocyan
zangocyan - 01.02.2023 21:33

But when we do it with async function, is it happening sequentially as in the ".then" function?

Ответить
Roy Miketsukami
Roy Miketsukami - 29.01.2023 23:43

man I love how you explain things so clearly

Ответить
saiteja gatadi
saiteja gatadi - 22.01.2023 23:07

One of the greatest video I've watched in 2023

Ответить
William Devonshire
William Devonshire - 21.01.2023 02:52

nice thanks again

Ответить
adnan ali
adnan ali - 17.01.2023 16:59

Thankyou for the awesome explainaton!

Ответить
Navin Ujuri
Navin Ujuri - 03.01.2023 21:43

Looking for this concept of comparison b/w async await and promise chaining for decade.... Finally found

Ответить
רוי רמתי
רוי רמתי - 21.12.2022 17:33

why does the parameter is passed in a dollar sign, what $(location) does?

Ответить
Ghost
Ghost - 17.12.2022 16:23

how can i call one function after another . 1 by one if the first function is successful then begin the second function !! plz help

Ответить
anuraj ms
anuraj ms - 16.12.2022 19:38

ty

Ответить
Francisco Peña
Francisco Peña - 13.12.2022 05:28

I like how you go straight to the point. Thanks

Ответить
Jeff DeSouza
Jeff DeSouza - 11.12.2022 20:34

Thanks! I leaned heavily on your videos while I was in a bootcamp and now have a good paying job! Thank you so much for your help -- I've been meaning to buy you a beer for some time <3

Ответить
SnowPlow
SnowPlow - 09.12.2022 01:06

You take a concept, boil it down into its essence and explain it using the most basic and easy to understand example. Incredible videos. By far the best channel on YT for this.

Ответить
Abhinav S
Abhinav S - 06.12.2022 20:19

Neat!!

Ответить
Tony Nguyen
Tony Nguyen - 01.12.2022 00:45

But await blocks code below until its resolved right?

Ответить
Raquel Betancourt
Raquel Betancourt - 14.11.2022 11:25

Excellent, thanks!

Ответить
GenZ Tech
GenZ Tech - 10.11.2022 20:30

Thank You

Ответить
Arshad Siddiqui
Arshad Siddiqui - 01.11.2022 21:39

You are the goat man!!!!!

Ответить
turboheadcrab666
turboheadcrab666 - 28.10.2022 23:56

It took JS a while to implement try/catch block.

Ответить
The Wicked Monarch
The Wicked Monarch - 27.10.2022 20:08

U are making it complicated. Lol. 😂

Ответить
Denisovich
Denisovich - 25.10.2022 15:29

Thank you so much

Ответить
watchitwitchu
watchitwitchu - 25.10.2022 13:47

You saved my life so many times with your clear explanations 🤣

Ответить
HR!T
HR!T - 25.10.2022 12:34

Very Precise Explanation!

Ответить
BrandFlipping
BrandFlipping - 18.10.2022 23:19

is await is being used only in front of a function that returns a promise? or we can use it before any of any function?

Ответить
Shaka
Shaka - 18.10.2022 17:08

Your videos are such overcomplicated garbage, overrated as shit,

Ответить