1// Find the index of a string in a given sentence
2function findNemo(sentence) {
3 let indexOfFirst = sentence.split(' ').indexOf('Nemo') + 1;
4 if(indexOfFirst >= 0){
5 return `I found Nemo at ${indexOfFirst}!`;
6 }
7 return ("I can't find Nemo :(");
8}
9
10
11console.log(findNemo("I am finding Nemo !")); //"I found Nemo at 4!"
12console.log(findNemo("Nemo is me")); //"I found Nemo at 1!"
13console.log(findNemo("I Nemo am")); //"I found Nemo at 2!"