Lulunga

Text Processing 04. String Substring

Jul 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (searchWord, sentence) {
  2.     let split = sentence.split(" ");
  3.     searchWord = searchWord.toLowerCase();
  4.     for (let word of split){
  5.         if(searchWord == word.toLowerCase()){
  6.             console.log (searchWord);
  7.             return;
  8.         }
  9.     }
  10.     console.log (`${searchWord} not found!`)
  11. }
Add Comment
Please, Sign In to add comment