title: "else if" Conditions in Javascript Calculator
body: <p>I'm trying to adapt a calculator that was made by someone else who used to work at my company. Unfortunately I can't get hold of him at all and was wondering if someone here could help me. My javascript knowledge is limited so please bear with me if this sounds a stupid question or if I'm missing something obvious. I can't find any info on this elsewhere, so any help would be much appreciated!</p>
  
  <p>Here is the current code for the section I want to change:</p>
  
  <pre><code>function date(){ 
          var the_date  = new Date();
      enter code herevar the_year  = the_date.getFullYear();
      ret_age=Number(document.calculator.year.value);
      gender=Number(document.calculator.sex.value);
      a=the_year-ret_age;
      if (a&lt;=36)
        {
      document.calculator.number3.value=68;
        }
      else if (a&gt;36 &amp;&amp; a&lt;=45)
        {
      document.calculator.number3.value=67;
        }
        else if (a&gt;=45 &amp;&amp; a&lt;=60)
        {
      document.calculator.number3.value=66;
        }
          else if (a&gt;60 &amp;&amp; gender==1)
        {
      document.calculator.number3.value=65;
        }
          else if (a&gt;60 &amp;&amp; gender==0)
        {
      document.calculator.number3.value=65;
        }
  
      else
        {
        alert("Our calculator is having trouble working out your state 
  pension age. You have been given a default age of 68. Feel free to 
  change it.");
          document.calculator.number3.value=68;
        }
  
          }
  </code></pre>
  
  <p>I want to add in these new 'else if' options, but I think that there is a problem with the number of conditions in each.</p>
  
  <pre><code>        else if (a&gt;60 &amp;&amp; gender==0)
        {
      document.calculator.number3.value=65;
        }
          else if (a&gt;60 &amp;&amp; &lt;=62 &amp;&amp; gender==0)
        {
      document.calculator.number3.value=62;
        }
          else if (a&gt;63 &amp;&amp; gender==0)
        {
      document.calculator.number3.value=60;
        }
  </code></pre>
  
  <p>Am I doing something wrong with trying to use eg. <code>a&lt;61 &amp;&amp; &lt;=63</code> alongside the gender condition? This appears to only work when I say one condition for the number, eg. <code>a&lt;60</code> </p>
  
  <p>Is there any way to use these two conditions in the else if, or will I have to do something different?</p>
  
  <p>It would be great if someone could help - again, apologies if this question is poorly explained. If you need any more info to help then please let me know! I'm not sure what I'm doing. Thank you! :)</p>