The location.hash property is used to either set or returns the anchor part of a URL. It also includes the hash sign (#). Do not include a hash (#) when we want to set the anchor part in location.hash .
Its syntax is:- location.hash OR location.hash = anchor_name
Its return is:- anchor part of the URL including the hash (#)
|anchor_name||The anchor part of a URL.|