← Back to challenges

Flip the Boolean

JavaScriptHardlogicconditionslanguage_fundamentals

Instructions

Create a function that reverses a boolean value and returns the string "boolean expected" if another variable type is given.

Examples

reverse(true) ➞ false

reverse(false) ➞ true

reverse(0) ➞ "boolean expected"

reverse(null) ➞ "boolean expected"
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sandwich Fillings