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