title: How to return anonymous object from one liner arrow function in javascript?
body: <p>I recently switched to es6 and started using arrow functions all over my code.
  While refactoring I came across below code</p>
  
  <pre><code>data.map(function(d) {
     return {id: d.id, selected: bool};
  });
  </code></pre>
  
  <p>I changed above code to this -</p>
  
  <pre><code>data.map((d) =&gt; {id: d.id, selected: bool});
  </code></pre>
  
  <p>But I was getting error from above code. I don't know what is wrong here?
  I know that If there is no block of code then there is implicit return provided by arrow function.</p>
  
  <p>But don't know how to return empty object or anonymous object with some properties initialized ?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>What is wrong if I do it in this way? Just for curiosity sake.</p>
  
  <pre><code>data.map((d) =&gt; new {id: d.id, selected: bool});
  </code></pre>