🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Async JavaScript: all 10 questions

Quiz: Async JavaScript · Question 5 of 10

What does this print? (code)

What does this print?

async function f() { return 5; }
f().then((v) => console.log(v + 1));
  1. A.5
  2. B.6
  3. C.[object Promise]1
  4. D.undefined
Answer & explanation

Correct answer: 6

f() returns a promise of 5; .then receives 5 and prints 6.

Can you get the rest right without peeking?

Take the timed Quiz: Async JavaScript quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →