I want to change the check value from false
to true
whenever I click on the a link. So far I've not found any suggestions on how to do this
<a href="#" class="click"></a>
<a href="#" class="click">Click Me</a>
let check = false;
document.querySelectorAll('.click').forEach(item => {
item.addEventListener('click', event => {
check = true;
});
});
console.log(check);