The HashChangeEvent() constructor creates a new HashChangeEvent object, that is used by the hashchange event fired at the window object when the fragment of the URL changes.
Note: A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing hashchange events.
new HashChangeEvent(type, options)typeA string with the name of the event. It is case-sensitive and browsers set it to hashchange.
options OptionalAn object that, in addition to the properties defined in Event(), has the following properties:
oldURL OptionalA string containing the old URL. Its default value is the empty string ("").
newURL OptionalA string containing the new URL. Its default value is the empty string ("").
A new HashChangeEvent object.
hashchange event