EkaterinaRomankova / Codewars

Codewars
0 stars 0 forks source link

Colour Association #65

Open EkaterinaRomankova opened 1 year ago

EkaterinaRomankova commented 1 year ago

Colour plays an important role in our lifes. Most of us like this colour better then another. User experience specialists believe that certain colours have certain psychological meanings for us.

You are given a 2D array, composed of a colour and its 'common' association in each array element. The function you will write needs to return the colour as 'key' and association as its 'value'.

For example: var array = [["white", "goodness"], ...] //returns [{white: 'goodness'}, ...]

function colourAssociation(array){ return array.map(x => ({[x[0]]: x[1]})); }