<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Custom promise example</title>
  </head>
  <body>
    <script>
      // Define custom promise function

      let timeoutPromise = new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve('Success!');
        }, 2000);
      });

      timeoutPromise
      .then(message => {
         alert(message);
      })
    </script>
  </body>
</html>
