what's the difference between those two syntax for creating an event ?
let event = document.createEvent('Event');
and
let event = new Event('event');
The first one is the old fashioned way inspired by Java and supported by older browsers like IE.
The second one is the now preferred one and it uses the Event constructor which is supported by all modern browsers.
You can read more here: https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events#the_old-fashioned_way
As stated in the @pilchard comment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With