I am working with an object and array in the following way:
let a = { x: 3, y: '3', z: 'z' };
The array I have is structured like this:
let b = [{ x: 1, y: '1'}, { x: 2, y: '2' }];
I want to achieve something similar to the code below:
b.push({ x, y } = a);
Rather than using either of these approaches:
b.push({ x: a.x, y: a.y });
// or this:
const { x, y } = a;
b.push({ x, y });