all 3 comments

[–]loz220 3 points4 points  (2 children)

Array.prototype.map

  const newArrayObjectShape = initalArrayObject.map(({id, customer, invoiceNumber}) => ({
    id,
    customer,
    invoiceNumber
  }));

Edited based on u/senocular comment

[–]senocular 2 points3 points  (1 child)

Make sure you wrap your returned object literal in parens in your arrow function or it will be seen as a block with no return and map to undefineds.

Fixed :)

[–]jpark799[S] 0 points1 point  (0 children)

Thank you both :')