OutputNot attempted
What flows through finally?
Promise.resolve(1) .then((v) => { console.log(v); return v * 2; }) .finally(() => { console.log('finally'); return 99; }) .then((v) => console.log(v)) .then((v) => console.log(v));Spaces and quote style don’t matter · write a thrown error as TypeError
Ctrl Enter
Show answer & explanation
The expected output comes from actually running the snippet; opening this shows it next to the explanation.
finally receives no value and its return value is ignored (unless it throws or returns a rejected promise), so 2 passes through. The last .then gets undefined because the previous one returned nothing.