A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-13.js
1Promise.resolve(1)
2.then(v=>v+1)
3.then(v=>{console.log(v);})
4.then(v=>{console.log(v);});
Async
Answer & explanation
Console output
2
undefined
Why
Promise chains pass the resolved value of each step to the next handler. The handler v => { console.log(v); } prints 2 but has no return, so it implicitly returns undefined. console.log itself also returns undefined. The next .then therefore receives undefined as its value and prints it.