JS Built-ins
Eventbeginner

Event Constructor β€” type property

πŸ“– Usage Example
const e = new Event('click')
e.type  // β†’ 'click'

Event() creates a new synthetic event with the specified type name.

Event

The Event constructor takes a type string as its first argument. The resulting event's type property reflects that string.

Challenge: Verify that new Event('click').type is 'click'.

πŸ’‘ Hints (1)
  • β€’ The first argument to new Event() becomes the type property