kstoyanov

04. String Substring

Jul 17th, 2020 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(wordInput, text) {
  2.   const isFind = text.toLowerCase()
  3.     .split(' ')
  4.     .filter((word) => word === wordInput);
  5.  
  6.   const findWord = isFind.join();
  7.  
  8.   if (findWord !== '') {
  9.     console.log(findWord);
  10.   } else {
  11.     console.log(`${wordInput} not found!`);
  12.   }
  13. }
Add Comment
Please, Sign In to add comment