<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Async Function Example</title>
</head>

<body>
  <script>
    // Define the async function
    async function functionName(parameter1, parameter2, ...parameterN) {
      // Async function statements
      document.write("Async function is running...");
      // Example asynchronous operation
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve("Async operation completed.");
        }, 2000);
      });
    }
    // Call the async function
    functionName("param1", "param2", "param3").then(result => {
      document.write(result); // Output the result
    }).catch(error => {
      document.write (error); // Handle errors
    });
  </script>
</body>

</html>
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.