Answer the question
In order to leave comments, you need to log in
Why is the presence of event checked?
function handleClick(event){
event && event.preventDefault();
// ......
}
In what situations can event be undefined?
Answer the question
In order to leave comments, you need to log in
If not transferred. This is a function, anything can be inside event, like undefined, for example
handleClick(); //вызвали, но не передали, а можно и передать undefined на самом деле
function handleClick(event){
console.log(event); //undefined
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question