async-await javascript node.js

Does await guarantee execution order without assignment in JavaScript?

Subject. Can I say that two pieces of code below are equal:

await someFunc() // no assignment here


someFunc().then(() => 

I tried and it looks like they are equal but there is a doubt(e.g. some optimization)

Yes they are exactly the same, it’s more or less syntactic sugar. The await causes execution to pause until the awaited Promise is resolved.

See Javascript async the section on rewriting a promise chain for more information.