title: Object destructuring in ES6
body: <p>I have a function which just return the part of existing object. in this case I am using Object destructuring but for this I need to repeat my code twice, one for retrieving properties and once for creating object like below.</p>
  
  <pre><code>function getPartlyState(obj) {
    const { x, y, z } = obj;
    return { x, y, z };
    //**OR**
    return { x: obj.x, y: obj.y, z: obj.z };
  } 
  </code></pre>
  
  <p>Is there any better way where I dont have to repeat my properties, something like below.</p>
  
  <pre><code>function getPartlyState(obj) {
    return { x, y,z } = obj;
  } 
  </code></pre>