title: Promise not waiting to finish
body: <p>I looked at many examples today. They seem to suggest that the following code should be executed in chain:</p>
  
  <pre><code>let f = () =&gt; {
      return new Promise((res, rej) =&gt; {
          console.log('entering function');
          setTimeout(() =&gt; {
              console.log('resolving');
              res()
          }, 2000)
      });
  };
  
  Promise.resolve()
      .then(f())
      .then(f());
  </code></pre>
  
  <p>Expected output would be:</p>
  
  <pre><code>entering function
  resolving
  entering function
  resolving
  </code></pre>
  
  <p>But it isn't. The output is </p>
  
  <pre><code>entering function
  entering function
  resolving
  resolving
  </code></pre>
  
  <p>and I can't figure out why. Any help will be much appreciated.</p>