check if array of string contains particular string code example
Example: how to Check if an array contains a string
// To check if an array contains a string
const colors = ['red', 'green', 'blue'];
const result = colors.includes('red');
console.log(result); // true
// Or
const colors = ['Red', 'GREEN', 'Blue'];
const result = colors.map(e => e.toLocaleLowerCase())
.includes('green');
console.log(result); // true