Strange problem with document.getElementsByTagName("a")
<p>Why doesn't it recognise 'number' as a variable in the following code, second line?</p>

<pre><code>var number = document.getElementsByTagName("a").length;
var link = document.getElementsByTagName("a")[number].href;
</code></pre>

<p>Of course it works with any real number instead of the variable.</p>
