one listener for multiple events code example
Example 1: window.addeventlistener multiple events
"mousemove touchmove".split(" ").forEach(function(e){
window.addEventListener(e,mouseMoveHandler,false);
});
Example 2: adding event listener to multiple elements
document.querySelectorAll('.some-class').forEach(item => {
item.addEventListener('click', event => {
//handle click
})
})