const button = document.getElementById('mainbtn'); button.addEventListener('click', function(e) { console.log('button was clicked'); });