Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //inventory of sunglasses in library.js file is to 0 - refer the code in previous paste
- //so the order shouldn’t go through
- const {checkInventory} = require('./library.js');
- const order = [['sunglasses', 1], ['bags', 2]];
- const handleSuccess = (resolvedValue) => {
- console.log(resolvedValue);
- };
- const handleFailure = (rejectReason) => {
- console.log(rejectReason);
- };
- // Write your code below:
- checkInventory(order)
- .then(handleSuccess)
- .catch(handleFailure)
- /*
- Output will show:
- $ node app.js
- We're sorry. Your order could not be completed because some items are sold out.
- $
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement