Professional Documents
Culture Documents
JavaScript Promise
JavaScript Promise
Promises
@coder_aishya
01
@coder_aishya
02
Promise States
Pending
fulfilled rejected
Settled state
@coder_aishya
03
Creating a Promise
Calling a Promise
@coder_aishya
04
Parameters
Promise constructor takes only one
argument which is a callback function
(and that callback function is also referred
as anonymous function too).
Callback function takes two arguments,
resolve and reject
Perform operations inside the callback
function and if everything went well then
call resolve.
If desired operations do not go well then
call reject.
@coder_aishya
05
@coder_aishya
06
@coder_aishya
07
Promise chaining
@coder_aishya
08
Combining Promises
Promise.all : is fulfilled if all promises that are
provided to it are fulfilled or if one of the
promises is rejected.
@coder_aishya
09
Combining Promises
Promise.allSettled : Returns when all
promises are settled (fulfilled or rejected).
@coder_aishya
Follow me for more
aishwarya-dhuri
coder_aishya