I used document.querySelectorAll() get a NodeList of all buttons in the HTML file, then iterated through each button to add an event listener to each button to listen for a click on each button.
document.querySelectorAll("button").forEach(node => {
node.addEventListener("click", console.log("Button clicked"));
});
However, on load, all buttons are clicked, and I do not understand why this is happening.