title: Using await outside of an async function
body: <p>I was attempting to chain two async functions together, because the first had a conditional return parameter that caused the second to either run, or exit the module. However, I've found odd behavior I can't find in the specs.</p>
  
  <pre><code>async function isInLobby() {
      //promise.all([chained methods here])
      let exit = false;
      if (someCondition) exit = true;
  }
  </code></pre>
  
  <p>This is a bastardized snippet of my code (you can see the full scope <a href="https://github.com/RUJodan/SourceUndead/blob/master/routes/lobby.js#L53" rel="noreferrer">here</a>), that simply checks if a player if already in a lobby, but that's irrelevant.</p>
  
  <p>Next we have this async function.</p>
  
  <pre><code>async function countPlayer() {
      const keyLength = await scardAsync(game);
      return keyLength;
  }
  </code></pre>
  
  <p>This function doesn't need to run if <code>exit === true</code>.</p>
  
  <p>I tried to do</p>
  
  <pre><code>const inLobby = await isInLobby();
  </code></pre>
  
  <p>This I hoped would await to results, so I can use <code>inLobby</code> to conditionally run <code>countPlayer</code>, however I received a typeerror with no specific details.</p>
  
  <p>Why can't you <code>await</code> an <code>async</code> function outside of the scope of the function? I know it's a sugar promise, so it must be chained to <code>then</code> but why is it that in <code>countPlayer</code> I can await another promise, but outside, I can't <code>await</code> <code>isInLobby</code>?</p>