title: What is the difference between a function expression vs declaration in JavaScript?
body: <p>What is the difference between the following lines of code?</p>
  
  <pre><code>//Function declaration
  function foo() { return 5; }
  
  //Anonymous function expression
  var foo = function() { return 5; }
  
  //Named function expression
  var foo = function foo() { return 5; }
  </code></pre>
  
  <ul>
  <li>What is a named/anonymous function expression?  </li>
  <li>What is a declared function?  </li>
  <li>How do browsers deal with these constructs differently?</li>
  </ul>
  
  <p>What do the responses to a similar question (<a href="https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname">var functionName = function() {} vs function functionName() {}</a>) not get exactly right?</p>