Question: i have a array `banks`
and I need to return one object with all the parameters described below

```
const banks = [{kod: 723,name: "bank",},{kod: 929,name: "bank2"}]

```

i tried to do it with 

```
const lookup = banks.map(item => {
  return ({[item.kod]: item.name }) 
})

```

but it returns the result `[ {723: "bank"}, {929: "bank2"} ]`

how can i achieve this result `{723: "bank",929: "bank2"}`

Answer: 
You can use [`.reduce()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) with the [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) like so:

```js
const banks = [{kod: 723,name: "bank",},{kod: 929,name: "bank2"}];

const res = banks.reduce((acc, {kod, name}) => ({...acc, [kod]: name}), {});
console.log(res);
```
You can use `reduce` instead

```js
const banks = [{kod: 723,name: "bank",},{kod: 929,name: "bank2"}]

const lookup = banks.reduce((op,item) => {
  op[item.kod] =  item.name
  return op
},{})

console.log(lookup)
```