JavaScript - When I declare a var named 'location', it gets sent to the URL? : <p>I just encountered the weirdest thing ever.</p>

<p>When I declare a variable called 'location', whatever the value of the variable gets sent to the URL.</p>

<pre><code>var location = 1;
// Results in http://localhost:8000/1

var location = document.getElementById('element');
// Results in http://localhost:8000/[object%20HTMLSelectElement]
</code></pre>

<p>This only happens for <code>location</code>.  If I use let's say <code>locations</code>:</p>

<pre><code>var location2 = 1;
// Nothing weird happens
</code></pre>

<p>I'm using Django.  I checked both my frontend and backend code and there doesn't seem to be any conflicting names.</p>

<p>What could be causing this?</p>
