JavaScript Window location.hash
JavaScript Window location.hash
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 .
Syntax:-
Its syntax is:- location.hash OR location.hash = anchor_name
Return:-
Its return is:- anchor part of the URL including the hash (#)
Further Explanation:-
Parameter | Description |
anchor_name | The anchor part of a URL. |