Suppose there are several buttons in an HTML file and the following code is executed:
const buttons = document.querySelectorAll('button');
buttons.forEach((btn) => {
btn.addEventListener('click', (e) => {
console.log(btn.textContent);
console.log(e.target.textContent);
});
});
What distinguishes 'btn' from 'e.target'? While event delegation could improve the code structure, I'm curious if these two variables are identical and can be used interchangeably.