Where can I find documentation to support this behavior?
<p>I'm looking over some previous developers code and I come across this line:</p>

<pre><code>location.href = '#' + variable;
</code></pre>

<p>Which has the effect of updating <code>location.hash</code>. Remove the '#' and of course it redirects to the non-existent url. Playing around a bit it seems I can set the hash via <code>location.href</code> as long as the value starts with '#'. This line or similar is used a lot, but I can't seem to find any documentation the supports this behavior of it updating <code>location.hash</code> by setting <code>location.href</code> this way. </p>

<p>I would like to see something showing this isn't just a happy accident that this works so I don't have to re-code all the situations where this is used. Anything you can link me to would help. </p>

<p>Would it be better to just changes these to properly set the <code>location.hash</code> anyway?</p>

<p>Thnks</p>
