title: Javascript cannot override window.confirm with async and promise
body: <p>Everywhere in my project I have </p>
  
  <pre><code>if(confirm('Are you sure you want to delete?')){
  </code></pre>
  
  <p>I need to override all with a more cute/nice dialog. <br>
  I cannot change manually all the confirms, so I need to override the confirm. <br>
  I made a simple test with <b>promise</b> and <b>async</b>, to see if it works</p>
  
  <p>I have tried to override confirm like this:</p>
  
  <pre><code>window.confirm = async function(message){
  </code></pre>
  
  <p>but is not working(immediately returns true, instead of waiting 2 sec as it should in my sample)</p>
  
  <pre><code>&lt;html&gt;
  &lt;script type="text/javascript"&gt;
  
  // override confirm
  window.confirm = async function(message){
          var result = await someAsyncFunc(); 
  
          return result;
  }
  
  // display a confirm
  DisplayConfirm();
  
  // delay the result 2sec
  async function someAsyncFunc(){
      let promise = new Promise((res, rej) =&gt; {
          setTimeout(() =&gt; res(true), 2000)
      });
  
      // wait until the promise returns us a value
      let result = await promise;    
  
      return result;
  }
  
  function DisplayConfirm(){
      if(confirm("it is a yes or a no ?")){
          alert("you clicked YES");
      }
      else{
          alert("you clicked NO");
      }
  }
  
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This sample should display a dialog, and after 2 sec to automatically return true. <br></p>
  
  <p>You can try the code here: <br>
  <a href="https://jsfiddle.net/gk4b5uwp/" rel="nofollow noreferrer">https://jsfiddle.net/gk4b5uwp/</a>
  <br>
  <br>
  <br>
  Please help</p>