I just can’t understand this page.
My answer was accepted for question #1. Below is my solution for question #1:
let prom = new promise ((resolve, reject) => { resolve( "Thank you. Your order was successful."
); } else { reject(“We’re sorry. Your order could not be completed because some items are sold out”) }; }; });
but when I got to the second question, I had to use the ‘view solution’ option which has the answer as
const handleSuccess = (resolvedValue) => {
console.log(resolvedValue);
};
const handleFailure = (rejectReason) => {
console.log(rejectReason);
};
checkInventory(order)
.then(handleSuccess, handleFailure);
Unless I’m mistaken, there is no reference to the question #1 at all. Additionally, I don’t understand how I should use the ‘setTimeout()’ function mentioned in question #1.
Can someone please help me understand?
Thank you.