diff --git a/files/en-us/web/api/location/hash/index.md b/files/en-us/web/api/location/hash/index.md
index 1c42d5eaf241968..bc65ae59d99a7ee 100644
--- a/files/en-us/web/api/location/hash/index.md
+++ b/files/en-us/web/api/location/hash/index.md
@@ -18,12 +18,11 @@ A string.
## Examples
-```html
-Examples
-
+Assuming the user has navigated to `https://example.org#examples`, the following code will log `#examples`:
+
+```js
+const result = location.hash;
+console.log(result);
```
## Specifications