Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function stringSubstring(word, text) {
- text = text.split(' ');
- let foundWord = false;
- for (currentWord of text) {
- if (word.toLowerCase() === currentWord.toLowerCase()) {
- foundWord = true;
- break;
- }
- }
- console.log(foundWord ? word : `${word} not found!`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement