title: What is a state machine in terms of JavaScript promises and C# asyc-await?
body: <p>I'm currently looking at <code>async-await</code> in C#, and noticed similarities to JavaScript promises. Looking into this I see that JavaScript is also going to support <code>async-await</code> statements, and that there are similarities between this and promises (look <a href="https://medium.com/@bluepnume/learn-about-promises-before-you-start-using-async-await-eb148164a9c8#.dswrmzrk9" rel="nofollow noreferrer">at this blog post</a> for example).</p>
  
  <p>On a whim, I wondered what JavaScript's implementation of <code>async-await</code> was and found this question (<a href="https://stackoverflow.com/questions/16539245/java-equivalent-of-c-sharp-async-await">Java Equivalent of C# async/await?</a>).</p>
  
  <p>The accepted answer suggests that <code>async-await</code> (and by extension, I guess, promises) are implementations of a 'state machine'.</p>
  
  <p><strong>Question:</strong> What is meant by a 'state machine' in terms of promises, and are JavaScript promises comparable to C#'s <code>async-await</code>?</p>