title: How do I loop through a 2 d array to filter out the arrays whose data in the array matches the value wanted
body: <p>This is the array:
  Local
  this: Object
  data:
  d:
  results: Array(3)</p>
  <pre><code>0: {__metadata: {…}, Id: 1, Title: 'Item 1', staffInChargeId: 99, ID: 1}
  1: {__metadata: {…}, Id: 15, Title: 'Item 2', staffInChargeId: 99, ID: 15}
  2: {__metadata: {…}, Id: 16, Title: 'Item 3', staffInChargeId: 80, ID: 16}
  </code></pre>
  <p>How can I filter through the array to filter out the arrays where staffInChargeId is equal to the LoginId?</p>
  <pre><code>        function LoadLinkResults(LoginId)
          {
                  
                              var LoginId = GetID(userIdLoginName);
                          
          
              $.ajax({  
                      url: _spPageContextInfo.webAbsoluteUrl + &quot;/_api/web/lists/GetByTitle('userForm')/items?$select=ID,Title,staffInChargeId&amp;?$top=20&quot;,  
                      headers: {  
                          Accept: &quot;application/json;odata=verbose&quot;  
                      },  
                     async: false,  
                      success: function(data) {
                                                  
                              if (data.d.results.length &gt; 0)
                              {
                                  for (var i = 0; i &lt; data.d.results.length; i++)
                                  {  
                                      //how do I  filter out the data whose staffInChargeId == LoginId?
                                      var item = data.d.results[i];  
                                      $('#LinkResults').append($(&quot;&lt;option&gt;&lt;/option&gt;&quot;).attr(&quot;value&quot;, item .staffInChargeId).attr(&quot;value&quot;, item .ID).text(item.Title));                 
                                  } 
                                                                          
                                  }
                              
                              },            
                          error: function(data) 
                          {
                          console.log(&quot;An error occurred. Please try again.&quot;);  
                          }
                  });
          }
      
      ```
  </code></pre>