Creating JavaScript Promises

preview_player
Показать описание
Not only do you need to know how to use promises, there are times you will need to create a promise. In this tutorial we walk through the process of creating a promise.

For more resources on JavaScript:

Full personalized courses on JavaScript:
Courses offered on Udemy: Getting Started or Advanced Topics at a huge discount:

Tutorials referred to in this video:

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

Thank you! THANK YOU! I very rarely comment on videos, but this is just pure gold! It's not an easy concept, and you understand how much beginners may struggle with it. That's why your explanation is so clear. Thank you, again!

lucksmith-wd
Автор

You're a very skilled teacher! Thanks, I really appreciate these videos!

MeAsMeButMe
Автор

This is just too good. I have to admit I did'nt understand this concept from the tutorial bought from Udemy, thanks for your generousity and selflessness!

yaolu
Автор

Oh, it's the best js promise lesson I ever seen!

chnsonic
Автор

Having fun rewriting this in ES6:
a.then(val => {console.log(val)}, (val) => {console.log("rejected: "+ val)});

someoneoutthere
Автор

Thank you so much! This definitely helped me in my overall understanding promises and using them for a bootcamp project due next week...!

michellanea_
Автор

You r great teacher. But the problem is promises is really very difficult topic. So can you make few more tutorials on this

pravinkolambkar
Автор

if somebody wanna use the last part with arrow syntax:


let setTimeoutPromise = (time) => {
return new Promise( (resolve, reject) => {
if (isNaN (time)) {
reject('a number is required\n please fill it again below')
}
setTimeout(resolve, time)
})
}

setTimeoutPromise('kami')
.then( () => {
console.log('done')
})
.catch( (error) => {
console.log(error)
})

MrMarkgyuro
Автор

What is the difference between 'new Promise' and 'return new Promise'?
Also you have written resolve with parenthesis "resolve()" and also without parenthesis "resolve". What is the difference here?
Thank you for this tutorial.

khorajia
Автор

Please explain what this line of code does

let promise =


});

What is the role of executor function in this context? how does it get called in back? what does it return ?

tusharubale
Автор

When I use setTimeout as: setTimeout(resolve("done"), 4000); --> this time it doesnt wait!! Why?

sevdamurat