<button type="button" data-ok="1" value="1">1</button>
<button type="button" data-ok="2" value="2">2</button>
<button type="button" data-ok="3" value="3">3</button>
<button type="button" data-ok="4" value="4">4</button>
let btns = document.querySelectorAll('[data-ok]');
btns.forEach(btn => btn.addEventListener('click', (e) => console.log(e.target.dataset.ok)))