Align Technology interview question

How can javascript handle asynchronous code if it is single threaded?