Advertisement
TZinovieva

String Substring JS Fundamentals

Mar 8th, 2023
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function stringSubstring(word, text) {
  2.     let words = text.split(' ');
  3.     for (let el of words) {
  4.         if (el.toLowerCase() === word.toLowerCase()) {
  5.             console.log(word);
  6.             return;
  7.         }
  8.     }
  9.     console.log(`${word} not found!`);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement