Interview question dispatchEvent
by Artem
JavaScript
// The code below doesn't alert anything
// Why
document.onclick = function(event) {
alert(event.type);
}
document.body.dispatchEvent(new CustomEvent('click'));
by Artem
// The code below doesn't alert anything
// Why
document.onclick = function(event) {
alert(event.type);
}
document.body.dispatchEvent(new CustomEvent('click'));