I have an array with multiples values
let array = ['value othervalue', 'value2 othervalue2']
I want to check :
if (array.includes('value')){
do that
}
It return false because its not 'value' its 'value othervalue'
I would like it to return true because the word is well existing but accompanied by another!
What javascript function can do that?
Thank you
You can use Array.some to check whether one of the items includes 'value':
let array = ['value othervalue', 'value2 othervalue2']
if(array.some(e => e.includes('value'))){
console.log('includes')
}