I have array that contain strings
commentArray ={ "words":[ "xyz", "abc", "random", "sample" ] }
And I want to match string
var comment = "hello world ran"
What I'm doing is
commentArray.words.find(words => {
if (comment.toLowerCase().includes(words.toLowerCase())) {
return true;
}
});
it giving true because "random" contains "ran" but I want true only if matches whole string not characters.
===instead of.includes?