Which of the following is used to consume a Promise?
- then()
- catch()
- finally()
- consume()
To consume the result of a Promise, you typically use the then() method. It allows you to specify what should happen when the Promise is successfully resolved. The other options are also Promise methods but serve different purposes, like error handling with catch() or running code regardless of the Promise's outcome with finally().
Loading...
Related Quiz
- To handle HTTP POST requests in Express, you would use the ______ method.
- How does JavaScript handle circular dependencies between modules?
- Using label with break or continue provides more control over which part of the code to ________ or ________ in JavaScript.
- To optimize CRUD operations in a high-write-load scenario, employing ______ strategies like write-behind caching can be effective.
- You are tasked with improving the reliability of a large codebase. Using Jest, how would you approach writing tests for functions with side effects like database calls or API requests?