title: Javascript- how do you convert this foreach loop to a regular for-loop?
body: <p>This nested  loop is running really slow in my app so I'm trying to change it to use regular for-loops instead of foreach.  I'm a little confused on the find() part.  Can someone help me convert this nested loop so that it doesn't use any foreach loops?  thanks.</p>
  
  <pre><code>   var filters = [];
      if (selectionTagFilters.length &gt; 0) {
          for (var i = 0; i &lt; selectionTagFilters.length; i++) {
              filterTree.forEach(function find(tag) {
                  if (tag.tagCategoryId == selectionTagFilters[i].tag.tagCategoryId) {
                      tag.tags.forEach(function find(tag) {
                          if (tag.tagId == selectionTagFilters[i].tag.tagId) {
                              filters.push({ tagHeader: tag.tagHeader, tagId: tag.tagId, tagCategoryId: tag.tagCategoryId });
                          }
                      });
                  }
              });
          }
      }
  </code></pre>