Understanding JavaScript event-based interactions