czwartek, 18 lipca 2019

Programming exercise #8 - dealing with objects

Imagine, that you have array of objects like this:

const array = [
{ name: "something", value: "something" },
{ name: "somethingElse", value: "something else" },
{ drinkName: "vodka", value: "Pshenicnaja" }
];

I want to ask you, about transform this array into one object, that looks like this:

const res = { name: 'somethingElse',
  value: 'Pshenicnaja',
  drinkName: 'vodka' }

As you can see, we do not want get duplicated keys in result.

Brak komentarzy:

Prze艣lij komentarz