Paylocity interview question

How does JS manage events?