JS-Dev-101 practice question 25 of 25
Which statement accurately describes an aspect of promises?
Full set: 148 questionsPromise.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.
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.
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).
Keep practicing
Take the free JS-Dev-101 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other JS-Dev-101 practice questions
- Question 1A developer executes: document.cookie; document.cookie = 'key=John Smith'; What is the be…
- Question 2A developer is required to write a function that calculates the sum of elements in an arr…
- Question 3Given the code below: 01 const delay = async delay => { 02 return new Promise((resolve, r…
- Question 401 function Animal(size, type) { 02 this.type = type || 'Animal'; 03 this.canTalk = false…
- Question 5Refer to the code snippet: 01 let array = [1, 2, 3, 4, 4, 5, 4, 4]; 02 for (let i = 0; i …
- Question 6Code: 01 let array = [1, 2, 3, 4, 4, 5, 4, 4]; 02 for (let i = 0; i < array.length; i++) …
