title: Javascript for loop finding before, equal, between and after values?
body: <p>I feel I'm missing something obvious. This is a simple example to illustrate my problem.</p>
  
  <p>I expect current = 3 to return 'before'. current = 4 should return 'key-two, current = 5 should return 'between', current = 7 should return 'key-two' current = 8 should return 'after'.</p>
  
  <p>This code doesn't work as expected. Setting current to 7 returns 'key-two', setting it to 8 or larger returns 'after' setting it to any other number returns between.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let items = []
  items['key-one'] = 4
  items['key-two'] = 7
  
  let current = 3
  
  let results = ''
  
  for(let key in items) {
      let keyOne = ''
      let keyTwo = ''
      if (key === 'key-one') {
          keyOne = items[key]
      }
      if (key === 'key-two') {
          keyTwo = items[key]
      }
      if (current &lt; keyOne) {
          results = 'before'
      }
      else if (current === items[key]) {
          results = key
      }
      else if (current &gt; keyOne &amp;&amp; current &lt; keyTwo) {
          results = 'between'
      }
      else if (current &gt; keyTwo) {
          results = 'after'
      }
  }
  document.write(results)</code></pre>
  </div>
  </div>
  </p>