Align Technology Interview Question

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