Skip to main content

One post tagged with "promises"

View All Tags

Wait, Does 'await' Make My Code Synchronous? Understanding Async/Await's Double Nature

· 12 min read
Mahmut Salman
Software Developer

I'm a backend developer learning frontend, and I just encountered something confusing. I use await login({ email, password }) and my code waits for the response before continuing—isn't that synchronous? 🤔 But the method is marked async, so it's asynchronous? My frontend mentor explained the beautiful double nature of async/await: it makes code look synchronous inside the function but stay asynchronous to the outside world. This conversation finally made async/await click for me.