My array consists of objects structured like this:
[
{prop1: valueA, prop2: valueB, prop3: valueC},
{prop1: valueD, prop2: valueE, prop3: valueF},
...
]
I am looking to transform this array into objects with a different structure:
[
{x: valueA, y: valueB},
{x: valueD, y: valueE},
...
]
In order to achieve this transformation, I need to select specific properties from the original objects and also rename them. Would using the rest operator be the best approach for this task? If so, what would be the most effective way to implement it? Your insights are much appreciated.