Question 14
Back to Exercise
What is a "thenable"?
- A A promise that has not been created yet
- B A function that returns then
- C A promise that can be cancelled
- D Any object with a then method, which promises and await treat like a promise Correct
Correct Answer: Option D
Promise.resolve({ then(r) { r(42); } }) fulfils with 42. This duck typing lets different promise libraries interoperate.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!