Source Code: (back to article)
<button id="removeEventButton">Click Me</button>

<script>
function showAlert() {
alert("This will be removed after first click");
}

const button = document.getElementById("removeEventButton");
button.addEventListener("click", showAlert);

button.addEventListener("click", function () {
button.removeEventListener("click", showAlert);
});
</script>