title: Can't make sense of these Functions
body: <pre><code>//iterator(value, key, collection)
    _.each = function(collection, iterator) { //takes in collection of values and a functino called iterator
      if(Array.isArray(collection)) { //if collection is array, proceed
        for (var key = 0; key &lt; collection.length; key++) { //iterates over the length of collection
          iterator(collection[key], key, collection);//plugs in individual element value, index of element, and array var
        }
      } else {
        for (var objKey in collection) {
          iterator(collection[objKey], objKey, collection);
        }
      }
    };
  
    _.indexOf = function(array, target){
      var result = -1; //set result to -1
  
      _.each(array, function(item, index) {
        if (item === target &amp;&amp; result === -1) {
          result = index;
        }
      });
  
      return result;
    };
  //example of input
    _.indexOf = function([1, 2, 3], 2)
  </code></pre>
  
  <p>I can't make sense of these functions.Specifically where _.each function is being used inside of the ._indexOf variable assignment. In the line of code where ._each(array, function(item, index) is executed. Are the results of that function then used to plug into the function of function(item, index) or is it the other way around? How does it know what item &amp; index parameters are for that variable? </p>