Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function task6() {
- function checkSpam(str) {
- str = str.toLowerCase();
- var spam = ['sex', 'spam'];
- for(var i = 0; i < spam.length; i++) {
- return !!~str.indexOf(spam[i]);
- }
- }
- console.log(checkSpam('get new Sex videos')); //true
- console.log(checkSpam('[SPAM] How to earn fast money?')); //true
- console.log(checkSpam('New PSD template')); //false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement