The following code iterates through a click event, logging its properties. However, it seems that the event "hides" properties other than "isTrusted" resulting a false
when calling hasOwnProperty
document.body.addEventListener("click",(e)=>{
for(var i in e){
console.log(e.hasOwnProperty(i),i);
}
});
Log:
true "isTrusted"
false "screenX"
false "screenY"
false "clientX"...
Same thing is when you call Object.keys(e)
the result is only the "isTrusted" property.
["isTrusted"]
Why is that? is there a way, other than for...in loop to list the event properties and values?