NOT Operator
The NOT
operator is represented by an exclamation mark !
in JavaScript. It takes a single operand and inverts its value. If the operand is true, then NOT
will make it false, and if the operand is false, then NOT
will make it true.
Here's an example:
Loading Code . . .
In the code above, the isNotRaining
variable is assigned the opposite value of the isRaining
variable. Since isRaining
is true
, isNotRaining
is assigned false
.
Loading Code . . .
In the code above, the canGoOutside
variable is assigned true
if it is not raining or if it is not too hot. Since isRaining
is false
and isTooHot
is true
, canGoOutside
is assigned true
.
In the exercise below, select all the options that evaluate to true
.
Loading Code . . .