Promises & Async/Await Interview Questions

    Question 1Promise States

    Which of the following is NOT a state of a JavaScript Promise?

    Question 2Creating a Promise

    How do you create a new Promise?

    Question 3then() Method

    What is the purpose of .then() in a Promise?

    Question 4catch() Method

    What does .catch() do in a Promise chain?

    Question 5Async Function Return

    What does an async function always return?

    Question 6Await Keyword

    What does the await keyword do?

    Question 7Handling Errors with Async/Await

    How do you properly catch errors in async/await?

    Question 8Promise.all()

    What does Promise.all([p1, p2, p3]) do?

    Question 9Multiple await Statements

    How does execution behave with multiple await statements?

    Question 10Converting Promise to Async/Await

    Which of the following is equivalent to:

    fetchData().then(data => console.log(data)).catch(err => console.log(err));