DEV Community

Anjali Gurjar
Anjali Gurjar

Posted on

District D company Question. Like

const x = [
{ a: 8, b: 3 },
{ c: 7, d: 9 },
{ a: 9, b: 3 },
{ c: 7, d: 94 },
{ a: 8, b: 3 },
{ c: 4, d: 0 },
{ a: 1, b: 5 },
{ c: 3, d: 20 }
];

// Transforming x into the required output structure (y)
const y = [
{ a: x[0] },
x[1],
x[2],
{ b: x[3] },
x[4],
x[5],
x[6],
x[7]
];

console.log(y);
And Second Event Sum of even number

Top comments (0)