function reference vs function call
Hello guys, can someone explain why when we use the method addEventListener in javascript, the function being passed as argument is a function reference and not a function call as below:
const button = document.querySelector("button");
function greet() {
const name = prompt("What is your name?");
const greeting = document.querySelector("#greeting");
greeting.textContent = `Hello ${name}, nice to see you!`;
}
button.addEventListener("click", greet);