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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *