SilkyFalcon

Generation

generate functionFri, 25 Nov 2022

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');

Questions about programming?Chat with your personal AI assistant