JS Built-ins
Eventintermediate

Event β€” isTrusted is false for constructed events

πŸ“– Usage Example
const e = new Event('x')
e.defaultPrevented  // β†’ false (before any preventDefault call)

defaultPrevented is true if preventDefault() has been called on the event.

Event.isTrusted

isTrusted is true only for events dispatched by the browser itself (e.g., user clicks). Events you create with new Event() always have isTrusted === false.

Challenge: Verify that new Event('x').isTrusted is false.

πŸ’‘ Hints (1)
  • β€’ isTrusted is a read-only property β€” you cannot set it to true in user code