Pregunta de entrevista de CERN

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

Respuesta de la entrevista

Anónimo

10 de sept de 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.