Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumHTMLdialog elementSingle-choice MCQ

What does this script log, and why?

const d = document.querySelector('dialog'); d.addEventListener('cancel', () => console.log('cancel')); d.addEventListener('close', e => console.log('close', JSON.stringify(e.target.returnValue))); d.showModal(); // user presses the Escape key