title: Creating a key array in jQuery
body: <p>I'm pretty new to jQuery and am sure there's a better way to do this, but heres what I have.</p>
  
  <p>Basically I've got an input field and a submit. The user can input their zip code to find a sales rep that covers their zipcode. I've got a short list of sales reps with zip code ranges to define their territories. I've got this working with the below code</p>
  
  <pre><code>var zipRange = {
      "john-smith":{
          "min":06001,
          "max":06098,
          "label":"john-smith"
      },
      "john-doe":{
          "min":10101,
          "max":11900,
          "label":"john-doe"
      },
  };
  
  jQuery( ".rep-search" ).click(function() {
  
      var userZip = jQuery( ".user-zip" ).val()
  
      if (userZip.length != 5) { 
          jQuery('.user-zip').addClass('error')
          jQuery('.error-message').show();
          jQuery('.rep-info').hide();
      } else {
          jQuery('.user-zip').removeClass('error')
          jQuery('.error-message').hide();
          for (rep in zipRange) {
              if (userZip &gt;= zipRange[rep].min &amp;&amp; userZip &lt;= zipRange[rep].max) {
                  jQuery('.rep-' + zipRange[rep].label).show();
              } else {
                  jQuery('.rep-' + zipRange[rep].label).hide();
              }
          }
      }
  
  });
  </code></pre>
  
  <p>The problem I'm having is that since this company has such a small rep list some of them have multiple territories. I'm able to adjust for this by just creating a second entry for the rep as so</p>
  
  <pre><code>"john-doe-2":{
      "min":07000,
      "max":07900,
      "label":"john-doe-2"
  },
  </code></pre>
  
  <p>But what I'd really like to do to is include the "min" and "max" keys as an array. Something like </p>
  
  <pre><code>"john-doe":{
      "min":{"1":10101,"2":07000};
      "max":{"1":11900,"2":07900};
      "label":"john-doe"
  },
  </code></pre>
  
  <p>What I'm stuck on is getting my for and if loop to work correctly with this. Like I said, I'm pretty new to this so if there's an obvious way to do this that I'm missing or a better way I wouldn't be surprised. Any help would be great, thank you!</p>