title: ECMAScript 6 arrow function that returns an object
body: <p>When returning an object from an arrow function, it seems that it is necessary to use an extra set of <code>{}</code> and a <code>return</code> keyword because of an ambiguity in the grammar.</p>
  
  <p>That means I can’t write <code>p =&gt; {foo: "bar"}</code>, but have to write <code>p =&gt; { return {foo: "bar"}; }</code>.</p>
  
  <p>If the arrow function returns anything other than an object, the <code>{}</code> and <code>return</code> are unnecessary, e.g.: <code>p =&gt; "foo"</code>.</p>
  
  <p><code>p =&gt; {foo: "bar"}</code> returns <code>undefined</code>.</p>
  
  <p>A modified <code>p =&gt; {"foo": "bar"}</code> throws <em>“<code>SyntaxError</code>: unexpected token: '<code>:</code>'”</em>.</p>
  
  <p>Is there something obvious I am missing?</p>