Add a click event listener to a button with the ID "submitBtn" that logs "Submit button clicked" to the console.
Events are actions or occurrences that happen in the browser, like clicks or key presses. JavaScript lets you respond to these events with event handlers (functions).
let button = document.getElementById("myButton");
button.addEventListener("click", function() {
alert("Button clicked!");
});
function handleClick() {
console.log("Button was clicked");
}
button.addEventListener("click", handleClick);
Removing Event Listenersbutton.removeEventListener("click", handleClick);