title: Arrow function object iteration with condition
body: <p>This question is about improving working code. I have a function showLabels that takes a value, iterates over an object and defines which label to return by comparing the value to the object keys. </p>
  
  <pre><code>  showLabels = (value) =&gt; {
      Object.keys(this.state.labels).forEach( key =&gt; {
        if (value &lt;= key) this.tooltip = this.state.labels[key];
      });
      return this.tooltip;
    }
  </code></pre>
  
  <p>The question: Is it possible to make this more succinct? Especially assigning the value of the function to this.tooltip and then returning it in the outer function seems unnecessarily verbose. </p>
  
  <p><strong>Example</strong></p>
  
  <p>Based on a comment here is an example:</p>
  
  <pre><code>this.state.labels = {0: "Smallest amount", 50: "In the middle", 100: "Top"}
  value = 33
  //showLabels(value=33) should return "In the middle"
  </code></pre>