document.createEvent('Event');
document.createEvent('CustomEvent');
new Event('click');
new CustomEvent('custom');
The Event and CustomEvent constructors (new Event(), new CustomEvent()) are the modern approach to creating events. The document.createEvent() method is considered legacy and should be avoided in modern code. The constructor approach is more straightforward, provides better type checking, and is more consistent with modern JavaScript patterns. CustomEvent additionally allows passing custom data via the detail property, making it perfect for application-specific events.