title: Hey wait a minute - there is a pending promise - or what?
body: <p>I'm trying to use the result of a promise function in a non-asynchronous manner. It doesn't matter how long the calculation of the digest will take - I just want the execution of the code to wait (block, hibernate, stop, ...) until there is a result for the promise:</p>
  
  <pre><code>async function sha1(str) {
      const r = await crypto.subtle.digest(`SHA-1`, new TextEncoder().encode(str));
      return Array.prototype.map.call(new Uint8Array(r), x =&gt; x.toString(16).padStart(2, 0)).join(``);
  }
  
  function test(str) {
      return sha1(str);
  }
  
  console.log(1);
  console.log(test("abc"));
  console.log(3);
  console.log(test("def"));
  </code></pre>
  
  <p>As long as I don't go into details in the debugger, the resulting console-log is always in a "pending" state.</p>
  
  <pre><code>[Log] 1 
  [Log] Promise {status: "pending"}
  [Log] 3 
  [Log] Promise {status: "pending"}
  </code></pre>
  
  <p>After opening the detail there is the correct result for each function call:</p>
  
  <pre><code>[Log] Promise
  result: "a9993e364706816aba3e25717850c26c9cd0d89d"
  status: "resolved"
  ...
  </code></pre>
  
  <p>I'm pretty sure I will get a "duplicate question" tag - but I couldn't find a satisfying answer. Sorry about that.
  Most of the examples just use an output function for demonstration purposes, but I need to <strong>return a value</strong> from the second function...</p>