title: Return index value from filter method javascript
body: <p>I have an array of objects in my angular controller.</p>
  <p>I want to return the value of the index of the field within the array which has a matching ID to my parameter.</p>
  <p>There will only be one object in the array with a matching <code>fieldId</code>..</p>
  <pre><code>$scope.indexOfField = function(fieldId) {
    return $scope.model.fieldData.filter(function(x) {
      if (x.Id === fieldId) return // ???????
    });
  }
  </code></pre>