title: How callback function's parameters work?
body: <p>So I'm trying to understand functional programming and higher order functions in specific. What I never clearly understood, was how callback function's parameters have a connection to, for example, an array? </p>
  
  <p>To be more clear, let's take this code example:</p>
  
  <pre><code>var friends = ["Mike", "Stacy", "Andy", "Rick"];
  
  friends.forEach(function (eachName, index){
  console.log(index + 1 + ". " + eachName); // 1. Mike, 2. Stacy, 3. Andy, 4. Rick
  });
  </code></pre>
  
  <p>How a callback parameter <code>eachName</code> knows that it means to return the item from array and <code>index</code> is supposed to return an index of array? How the connection between an array and callback parameter works?</p>