title: React extract value from list-keys
body: <pre><code> getEmployeeCredits(id) {
          if (this.state.company_roles) {
              return this.state.company_roles.map(function (cr, i) {
                  if (cr.id  === id) {
                      return cr.assigned_credits
                  }
              }.bind(this));
          }
      }
  </code></pre>
  
  <p>I want to return the assigned credits of the company role whose value matches over here. But the value which is returned is: <code>[undefined, undefined, undefined, "10000.0"]</code>.</p>
  
  <p>In this the undefined value is because of company roles for which the values didn't match. I can delete all the <code>undefined</code> values and then just use the value <code>10000.0</code> but is there a more elegant way to do this?</p>
  
  <p>EDIT: THE <code>if (cr.id === id)</code> condition will always be true for only a single value.</p>