-1

guys! i'm at a dead end(

I have an array of objects:

[{"All": "all"}, {"Success": "successCompleted"}, {"Refund": "refunded"}, {"Error": "error"}]

So, I need to get this from that array:

{All: "all", Success: "successCompleted, Refund: "refunded", Error: "error"}

But I can't find any pretty solution (

Please help someone!

0

1 Answer 1

2

const input = [{"All": "all"}, {"Success": "successCompleted"}, {"Refund": "refunded"}, {"Error": "error"}]

const output = input.reduce((final, obj) => ({ ...final, ...obj }))

console.log(output)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.