title: Beginner here. I need help understanding this callback function better
body: <p>So, I'm learning about promises, and to demonstrate promises, the instructor is first starting with traditional callback example. However, I'm a little confused on the syntax he's using and where some extra parameters seem to have appeared from. </p>
  
  <p>What I'm looking for is a dumbed down explanation to help me wrap my head around it. These are my specific questions: </p>
  
  <ol>
  <li><p>In the first line of the code below, is 'callback' and argument? Is it the name of the function? Or is it something else? </p></li>
  <li><p>On the third and fourth lines, I understand what we're passing in (either the error or the result), but I don't understand where those two parameters came from since we didn't define two parameters anywhere. How does the program know that's okay and not throw an error? </p></li>
  </ol>
  
  <p>I don't need help with understanding when the function is called, though, because I understand that, it's just some of the stuff in defining the function that I'm confused on. I think it might be the arrow syntax that's throwing me off. </p>
  
  <p>I've tried googling and rewatching the videos over and over again, but still can't grasp what's going on. </p>
  
  <pre class="lang-js prettyprint-override"><code>const doWorkCallback = (callback) =&gt; {
      setTimeout(() =&gt; {
         // callback('This is my error', undefined)
         callback(undefined, [1, 4, 7])
      }, 2000)
  }
  
  doWorkCallback((error, result) =&gt; {
      if(error) {
          return console.log(error)
      }
  
      console.log(result)
  
  })
  </code></pre>