Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. function solve(searchWord, text) {
  2. text = text.toLowerCase();
  3.  
  4. if (!text.includes(searchWord)) {
  5. console.log(`${searchWord} not found!`);
  6. }
  7.  
  8. let words = text.split(' ');
  9.  
  10. for (let word of words) {
  11. if (word === searchWord) {
  12. console.log(word);
  13. break;
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement