Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 671 Bytes

Colour Association.md

File metadata and controls

18 lines (13 loc) · 671 Bytes

Description:

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'.

Examples (input --> output):

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

Solution:

function colourAssociation(array){
  return array.map(([colour,association]) => ({[colour]: association}))
}