Code Lab

Spam check

EasyStrings3 min

Write a function checkSpam(text) that returns true if the string contains free money or xxx, and false if not. Letter case does not matter.

Examples

checkSpam('Get FREE money now')

Returns true

checkSpam('xXx files')

Returns true

A match at the very start of the string counts too.
checkSpam('Release notes')

Returns false

Source

Loading the editor...
  1. InputcheckSpam('Get FREE money now')
    Expectedtrue
  2. InputcheckSpam('xXx files')
    Expectedtrue
  3. InputcheckSpam('Release notes')
    Expectedfalse

Hidden tests run on Submit.