addeventlistener alert function code example
Example 1: javascript eventlistener
document.addEventListener('click', () => {
});
Example 2: event listener javascript
document.querySelector('div').addEventListener('click', () => {
console.log('div clicked');
});