const checkbox = document.getElementById('myCheckbox')
checkbox.addEventListener('change', (event) => {
if (event.currentTarget.checked) {
alert('checked');
} else {
alert('not checked');
}
})
//HTML INPUT VVVVVVVVVVVVVV
<input id="myCheckbox" type="checkbox" />