check if text contains any swear words
Script function check(text) { var swearWords = ['fuck', 'bitch', 'shit', 'damn', 'cunt']; for (var i = 0; i < swearWords.length; i++) { if(text.indexOf(swearWords[i]) !== -1) { return 'That\'s the worst!'; } else { return 'This is nice'; } } } check('fuck');