I have a list of requested colours that I am passing to a function:
const requestedColours = ['blue','green'];
I pass this into a function which contains an object with details of various colours:
colorOptions(requestedColours) {
const options = {
blue: {
icon: 'sea.jpg',
title: 'Sea Blue',
},
green: {
icon: 'leaf.jpg',
title: 'Leafy green',
},
pink: {
icon: 'flower.jpg',
title: 'Rose Pink',
}
}
return options.some(requestedColours);
}
The following line I'm aware is incorrect:
return options.some(requestedColours);
However I also tried, for example:
return options.some('blue');
And this does not return the sub-object for blue
, how do I correctly use array.some
?