Rootstack interview question

How does the promises work on JavaScript?