title: What's the benefit of assigning a function to a variable vs just calling the function?
body: <p>I'm struggling to see the differences and benefits  between defining a function as a variable vs just defining a function with a name. When would it be better to use each type?</p>
  
  <p><strong>Simple function definition</strong> </p>
  
  <pre><code>function add(a,b) {return a+b;};
  // and calling it like this when you need it:
  add(5,2) // Sum 7
  </code></pre>
  
  <p>vs </p>
  
  <p><strong>As a variable:</strong> </p>
  
  <pre><code>add = function(a,b) {return a+b;};
  // and calling it like this when you need it:
  add(5,2) // Sum 7
  </code></pre>
  
  <p>Apologies for the rookie question. Thanks!</p>
  
  <p><em>Edited: typos</em></p>