title: javascript if else logic does not work
body: <p>i'm new to programming and have tried to program if-else logic to create arrays etc.. </p>
  
  <p>I want to use a points variable to decide which points-interval the variable falls within  and then make the array with funfacts for that interval and return a random funfact from this array.</p>
  
  <p>For instance I have the milestones 1000, 2500, etc. If the userScorePoints is over 2500, I want the method to return a random funfact from the array that contains funfact about that number, up to the point that userScorePoints has reached the next milestone, which is 5000.</p>
  
  <p>The problem with the code I have written is that it only returns a random funfact from the first if, so I only get funfacts from the number 1000, even though I should have got funfacts from the number 2500 since my points now is over 2603.. </p>
  
  <p>Can someone please help me with this..?</p>
  
  <p>Here is my <em>code</em>:</p>
  
  <pre><code>function getFunfact(userScorePoints) {
      var array = new Array();
  
      if (1000 &lt;= userScorePoints &lt; 2500) {
          var funfact1000 = new Array();
          funfact1000[0] = "funfacts about the number 1000";
          funfact1000[1] = "...";
          funfact1000[2] = "...";
          funfact1000[3] = "...";
          funfact1000[4] = "...";
          funfact1000[5] = "...";
          array = funfact1000;
      } else if (2500 &lt;= userScorePoints &lt; 5000) {
          var funfact2500 = new Array();
          funfact2500[0] = "funfacts about the number 2500";
          funfact2500[1] = "...";
          funfact2500[2] = "...";
          funfact2500[3] = "...";
          funfact2500[4] = "...";
          funfact2500[5] = "...";
          array = funfact2500;
      } else if (5000 &lt;= userScorePoints &lt; 10000) {
          var funfact5000 = new Array();
          funfact5000[0] = "funfacts about the number 5000";
          funfact5000[1] = "...";
          funfact5000[2] = "...";
          funfact5000[3] = "...";
          funfact5000[4] = "..."
          funfact5000[5] = "...";
          array = funfact5000;
      } else if (10000 &lt;= userScorePoints &lt; 20000) {
          var funfact10000 = new Array();
          funfact10000[0] = "funfacts about the number 10.000";
          funfact10000[1] = "...";
          funfact10000[2] = "...";
          funfact10000[3] = "...";
          funfact10000[4] = "...";
          funfact10000[5] = "...";
          array = funfact10000;
      } else if (20000 &lt;= userScorePoints &lt; 30000) {
          var funfact20000 = new Array();
          funfact20000[0] = "funfacts about the number 20.000";
          funfact20000[1] = "...";
          funfact20000[2] = "...";
          funfact20000[3] = "...";
          funfact20000[4] = "...";
          funfact20000[5] = "...";
          array = funfact20000;
      } else if (30000 &lt;= userScorePoints &lt; 50000) {
          //etc.
      } else {}
      return array[getRandom(6)]; //this method returns a random element, this one works.
  </code></pre>