JavaScript function not defined in HTML-document, why not?
<p>I am coding a program that lets a user put in a telephone number and tell the user if it's accepted / denied based on a few conditions. 
I've worked out the function that does the calculation, but I can't get the JavaScript to work with the HTML-document: it doesn't get found.</p>

<p>Here are the two codes: (JS then HTML):</p>

<pre><code>function testanummer(nummer){
    nummer = document.getElementById("a").value;
    if isNaN(nummer){
        console.log("Hi! This phone number appears faulty, please try again.");
    } else if (nummer.length &lt;=8) &amp;&amp; else if (nummer.length &gt;=14) {
        console.log("Thanks! We'll be in touch shortly.");
    } else {
        console.log("Hi! This phone number appears faulty, please try again.");
    }
</code></pre>

<p>HTML:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt; Uppgift nummer 5&lt;/title&gt;

    &lt;script src="testanummer.js"&gt;&lt;/script&gt;
&lt;/head&gt; 


&lt;body&gt;
    &lt;form&gt;
        &lt;label for="a"&gt;Skriv in ditt telefonnummer här: &lt;/label&gt;
        &lt;input type="text" name="nummer" id="a"&gt;
        &lt;input type = "button" value ="Testa telefonnummer" onclick="testanummer(nummer);"&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Any idea why it doesn't work? I get this error:</p>

<blockquote>
  <p>Uncaught SyntaxError: Unexpected identifier </p>
</blockquote>

<p>and:</p>

<blockquote>
  <p>Uncaught ReferenceError: testanummer is not defined</p>
</blockquote>

<p>Any ideas why it doesn't work? </p>

<p>Thanks a lot! </p>
