16 lines
305 B
Markdown
16 lines
305 B
Markdown
importance: 5
|
|
|
|
---
|
|
|
|
# Check for spam
|
|
|
|
Write a function `checkSpam(str)` that returns `true` if `str` contains 'viagra' or 'XXX', otherwise `false.
|
|
|
|
The function must be case-insensitive:
|
|
|
|
```js
|
|
checkSpam('buy ViAgRA now') == true
|
|
checkSpam('free xxxxx') == true
|
|
checkSpam("innocent rabbit") == false
|
|
```
|
|
|