Summary
Javascript/the DOM have plenty of useful built-in events, but if there is an event that doesn't exist that you want to use, the event won't magically appear. Thankfully, custom events allow you to make virtually anything happen; all you need to do is write it first. To create one, you assign a new CustomEvent object to a variable, and two parameters are passed in. The first one is simply the name you wish to assign to it while the second one holds everything you want the event to do. However, like other newly created features, the DOM doesn't know about the event yet, so you also need to dispatch it. After that, you can use the event like you would any other. Furthermore, custom events can be used to modularize code, allowing for easier understanding and easier testing since everything is more isolated. In essence, custom events are just something you want to make happen that doesn't have a way to happen yet.