in this exercise , i got So confused!
at first, in the sample code :
let myPromises = Promise.all([returnsPromOne(), returnsPromTwo(), returnsPromThree()]);
myPromises
.then((arrayOfValues) => {
console.log(arrayOfValues);
})
.catch((rejectionReason) => {
console.log(rejectionReason);
});
used brackets for callback functions in Promice.all
.
but when i try to do this to solve the code, the solution was without them.
and second, when i try to writ callback function for .then
and .catch
, (witch means onFulfill
and onReject
functions like
Promise.all([checkSunglasses(),checkPants(),checkBags()])
.then(onFulfill())
.catch(onReject());
). the site was stop me again and at least it shows i must use their callback functions without brakets.
and in the end, please help my to find out why we don’t use new Promise for those 3 function when we declare them and just pass the function to them.
So why?
please help me