To handle both resolve and reject in a single method, you can use the .finally method after a(n) _______ block in asynchronous functions.
- try
- await
- then
- catch
To handle both resolve and reject outcomes in a single method, you can use the .finally() method after a try block in asynchronous functions. This ensures that the provided code block is executed regardless of whether the Promise is resolved or rejected.
Loading...
Related Quiz
- Consider a function that fetches user information from an API. If the API call fails, you want to log an error message and then continue the execution of the function without throwing an exception to the outer scope. Which Promise method should you use to achieve this?
- What is the purpose of the default case in a switch statement?
- To avoid iterating over prototype properties with for...in, you should use the _______ method.
- Which data type is NOT available in JavaScript?
- What is the default binding of "this" in JavaScript?