Infogain interview question

Explain how javascript event loop works