I have an array of colors:
colors = ['red','blue','purple'];
I would like to display the following message:
colors in ('red','blue','purple')
When I tried to achieve this using forEach method:
colors.forEach((color) => {
console.log(`colors in ('${color}')`);
});
The output shown is:
colors in ('red') colors in ('blue') colors in ('purple')
Any suggestions on how I can get the desired initial message?