JavaScript · Junior · Question 34 of 75

What does an async function return?

Explanation

async function f() { return 42 } returns Promise<42>. An exception inside becomes a rejected promise. That's why the result is obtained with await or .then().

Further reading

Problem with a question

JavaScript · Junior · question 34

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz