Domanda di colloquio di CERN

What is the difference between await/async and .then() in javascript?

Risposta di colloquio

Anonimo

10 set 2025

They are functionally similar (both work with promises), but await will wait for the promise to produce a result before continuing to the next statement. .then() accepts a callback instead. await/async tends to produce more readable code, but cannot always be used if you e.g. want to run two series of events at the same time.