$\require{cancel}$
<li> <input type="button" value = "Button1" id="Button1"/>
<li> <input type="button" value = "Button2" id="Button2"/>
...
<script>
function fun1() {
console.log("I was called")
}
const button1 = document.getElementById("Button1")
const button2 = document.getElementById("Button2")
const button2a = document.getElementById("Button2a")
const button3 = document.getElementById("Button3")
const button3a = document.getElementById("Button3a")
button1.onclick = fun1;
button2.onclick = function () {console.log("I was called too") }
button2a.addEventListener("click", function(){ console.log("I too was called")})
button3.onclick = () => {console.log("Called with an arrow function")}
button3a.addEventListener("click", () => {console.log("arrow function!!!!")})
</script>
addEventListener() is the preferred method.
void * data parameter.