var sentence = prompt('Enter Sentence Here: ')
if(sentence === 'Billy'){
console.log('Great!');
}
I was wondering if there is a way to return "Great!' if the sentence isn't just "Billy" For Example how could you return "Great!" if the sentence was "My name is Billy" so what what I'm asking for is how to I get the if statement to scan the sentence and determine if that word is present then return what I wish.
My apologies for the simplicity and stupidity, this is my first day learning JS.
if( sentence.indexOf("Billy") > -1)would be one way.array = string.split(); for(i of array) if(i=='Billy') console.log('Great');