Welcome to Node.js v21.6.2.
Type ".help" for more information.
> window.dispatchEvent(new Event('counterChange'))
Uncaught ReferenceError: window is not defined
$ node
Welcome to Node.js v20.6.1.
Type ".help" for more information.
> const target = new EventTarget()
undefined
> target.dispatchEvent(new Event("counterChange"))
true