var sentence = 'The quick brown fox jumped over the lazy dog.';
var word = ['fox'];
console.log('The word "' + word + (sentence.includes(word)? '" is' : '" is not') + ' in the sentence');
// expected output: "The word "fox" is in the sentence"
This is the String.includes() in the Javascript docs but what I want to do is something like this:
var sentence = 'The quick brown fox jumped over the lazy dog.';
var word = ['fox', 'dog'];
console.log('The word "' + word + (sentence.includes(word)? '" is' : '" is not') + ' in the sentence');
I want to test an array of strings to the sentence and return true if one of the strings in the array are in the sentence. But as you can see in the snippet, it does not work.
someon word instead