JS-Dev-101 practice question 25 of 25

Which statement accurately describes an aspect of promises?

Full set: 148 questions
Answer options
A: Arguments for the callback function passed to .then() are optional. Correct answer
B: .then() cannot be added after a catch.
C: .then() manipulates and returns the original promise.
D: In a .then() function, returning results is not necessary since callbacks will catch the result of a previous promise.
Correct Answer:
A. Arguments for the callback function passed to .then() are optional.
Explanation

Promise.prototype.then(onFulfilled?, onRejected?) defines both parameters as optional (indicated by the “?”). A developer may pass only one, both, or neither argument; the method still returns a new promise that adopts the appropriate state.

Why Incorrect

B. A then() can be chained after catch(); promises remain chainable.
C. then() always returns a new promise, leaving the original promise untouched.
D. If a then() callback omits an explicit return, the next then() receives undefined, not the previous result.

References

1. ECMAScript 2023, §25.6.4.3 Promise.prototype.then, Note 1 (both parameters optional, returns new Promise).

2. Stanford CS193p “Modern JavaScript”, Lecture 7 slides 15-17 (promise chaining, optional handlers).

Scroll to Top