.close
- наоборот, закрыть.const modal = document.querySelector('.modal');
const close = modal.querySelector('.close');
document.addEventListener('click', function(e) {
if (e.target === modal || e.target === close) {
modal.style.display = 'none';
}
if (e.target.tagName === 'BUTTON') {
modal.style.display = 'block';
}
});