What is the primary purpose of the async keyword in a function declaration?
- Enables the function to return a Promise
- Specifies that the function can be called asynchronously
- Defines a function that can only be executed in an asynchronous manner
- Marks a function as an asynchronous event handler
The async keyword is used to make a function return a Promise. This allows the use of await within the function, indicating that it contains asynchronous code.
Loading...
Related Quiz
- A for...of loop is best suited for iterating over ________ data structures, like arrays and strings.
- When destructuring an array, the syntax _________ is used to skip over elements.
- If a project is using a third-party library with multiple components, but only a few are needed, how can tree shaking be utilized for efficiency?
- In a Promise chain, where should you place a .catch() method for centralized error handling?
- What is a key difference between functional composition and method chaining?