// jshint esversion: 6
//define event handler
let main = function() {
//dispatch on button id
if (this.id == "btn1") {
//handle button 1 here
}
};
//register event handler
window.addEventListener("load", function() {
let buttons = document.querySelectorAll("button");
for (var i = 0; i < buttons.length; ++i)
//when the button gets clicked, who ya gonna call?
buttons[i].addEventListener("click", main);
});