title: Why does the 2nd function return undefined?
body: <p>I have 2 JavaScript functions that return the same object, upon calling both functions one after another, why does the 2nd function return <code>undefined</code>?</p>
  
  <pre><code>function foo1()
  {
    return {
        bar: "hello"
    };
  }
  
  function foo2()
  {
    return
    {
        bar: "hello"
    };
  }
  
  console.log(foo1());
  console.log(foo2());
  
  // foo1 returns:
  // Object {bar: "hello"}
  // foo2 returns:
  // undefined
  </code></pre>