代码示例:(标识:jsck_location_hash)
<!DOCTYPE html>
<html>
<body>

<h1>Window Location 对象</h1>

<h2>hash 属性</h2>

<p><a id="w3s" href="/javascript/js_es6.html#mark_array_from">JavaScript 2015 Array.from()</a><p>

<p id="demo"></p>

<script>
let url = document.getElementById("w3s");
document.getElementById("demo").innerHTML = "URL 的锚部分:" + url.hash;
</script>

</body>
</html>
运行结果: