logo CodeStepByStep logo

promiseMistakes

Language/Type: JavaScript Promises

Which of the following changes should NOT be made to the following code that uses promises, assuming that the intent is to run asynchronous functions f1, f2, f3, and f4 in that order?

f1().then(function(result) {
    f2(result)
    .then(newResult => f3(newResult));
}).then(() => f4());
// Forgot to terminate chain with a catch!

output
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.