Many languages allow multiple values to be returned from a function. For example, in Python this works:
def get_user():
return "[email protected]", 21, "active"
email, age, status = get_user()
However, in JavaScript, that's not allowed!
function getUser() {
return "[email protected]", 21, "active";
// DON'T DO THIS
// it only returns 'active'
}
Strangely, the JavaScript code above won't actually throw any sort of error, it will just silently return the "active" string.... which is unintuitive behavior that you probably didn't want. You can only return one value from a function in JavaScript!
To get around this, most developers return an object that contains the values they want to return. We'll cover objects later.
Textio has a built in profanity detector, but it's currently broken. Fix the isClean function so that it only returns whether the given message contains profanity.