title: Destructure object properties inside array for all elements
body: <p>In its most basic form, having an array of objects:</p>
  
  <pre><code>let arr = [
    {val:"a"},
    {val:"b"}
  ];
  </code></pre>
  
  <p>How can destructuring be used, to obtain only the values <code>['a', 'b']</code>.</p>
  
  <p>getting the first value is easy:</p>
  
  <pre><code>let [{val:res}] = arr; //res contains 'a'
  </code></pre>
  
  <p>Obtaining all values inside the array can be done with the rest operator:</p>
  
  <pre><code>let [...res] = arr; //res contains all objects
  </code></pre>
  
  <p>Combining those, I expected to be able to use:</p>
  
  <pre><code>let [...{val:res}] = arr; //undefined, expected all 'val's (['a', 'b'])
  </code></pre>
  
  <p>The above returns undefined (Tested in FF). Some further testing seems to indicate that adding the rest operator when using an object destructuring as well doesn't use the iteration, but gets back the original object, e.g. <code>let [...{length:res}] = arr; //res= 2</code>. Some other trials, such as <code>let [{val:...res}] = arr;</code> or <code>let [{val}:...res] = arr;</code> produce syntax errors.</p>
  
  <p>It's easy enough to do with other methods, such as using <code>map</code> on the array, but mostly I stumble upon this problem while destructuring multiple levels (an array with objects which have their own property containing an array). Therefore I'm really trying to get around how to do it solely with destructuring.
  For convenience: <a href="https://jsfiddle.net/3y75Lgzh/" rel="noreferrer">a test fiddle</a></p>
  
  <p><strong><em>edit</em></strong></p>
  
  <p>My apologies if I failed to explain the goal of the question. I'm not looking for a solution to a specific problem, only to find the correct syntax to use when destructuring. </p>
  
  <p>Otherwise formulated, a first question would be: in the example above, why doesn't <code>let [...{val:res}] = arr;</code> return all values (<code>['a', 'b']</code>). The second question would be: what is the proper syntax to use a rest operator with a nested object destructuring? (pretty sure I've gotten some definitions mixed up here). It seems that the latter is not supported, but I haven't come across any documentation that (and why) it wouldn't be.</p>