AiSensy interview question

How does promise works in JS