Promises & Async/Await Interview Questions

    Question 1: Promise States

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

    Question 2: Creating a Promise

    How do you create a new Promise?

    Question 3: then() Method

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

    Question 4: catch() Method

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

    Question 5: Async Function Return

    What does an async function always return?

    Question 6: Await Keyword

    What does the await keyword do?

    Question 7: Handling Errors with Async/Await

    How do you properly catch errors in async/await?

    Question 8: Promise.all()

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

    Question 9: Multiple await Statements

    How does execution behave with multiple await statements?

    Question 10: Converting Promise to Async/Await

    Which of the following is equivalent to:

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