Комментарии:
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 😭😭
ОтветитьNow I am more confused lol
ОтветитьBest explanation I've found and that too in only 7 minutes! You are amazing!
ОтветитьJust the right measure of knowledge and example code to pass on the idea, thank you it's a very good tutorial.
ОтветитьThank You So Much BROTHER............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Ответить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)
})
}
)
GoodJob!
ОтветитьHard names they give to simple things
I thought it will be hard LOL
Thanks for the video. Please note that your cursor is nearly invisible.
ОтветитьI watched about 10 videos, it's very diffucult topic to understand
Ответить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. 👍
ОтветитьAnother fine video.
Subscribed to your channel now.
Thank you!
can you please paste a link so we can see the example code that you are using in tutorial.
ОтветитьLove you man
ОтветитьHow to use async await inside promise?
Ответитьthank you so much for teaching this stuff
ОтветитьThanks for this video. i think this is the most simplest and easily understandable video all over yt on async/await
Ответитьi dont get why use async await when the code is so much longer
ОтветитьThank you very much.
ОтветитьGoat
ОтветитьBut when we do it with async function, is it happening sequentially as in the ".then" function?
Ответитьman I love how you explain things so clearly
ОтветитьOne of the greatest video I've watched in 2023
Ответитьnice thanks again
ОтветитьThankyou for the awesome explainaton!
ОтветитьLooking for this concept of comparison b/w async await and promise chaining for decade.... Finally found
Ответитьwhy does the parameter is passed in a dollar sign, what $(location) does?
Ответитьhow can i call one function after another . 1 by one if the first function is successful then begin the second function !! plz help
Ответитьty
ОтветитьI like how you go straight to the point. Thanks
Ответить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
Ответить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.
ОтветитьNeat!!
ОтветитьBut await blocks code below until its resolved right?
ОтветитьExcellent, thanks!
ОтветитьThank You
ОтветитьYou are the goat man!!!!!
ОтветитьIt took JS a while to implement try/catch block.
ОтветитьU are making it complicated. Lol. 😂
ОтветитьThank you so much
ОтветитьYou saved my life so many times with your clear explanations 🤣
ОтветитьVery Precise Explanation!
Ответить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?
ОтветитьYour videos are such overcomplicated garbage, overrated as shit,
Ответить