January 2020
Intermediate to advanced
548 pages
13h 36m
English
The NOT operator is a unary operator. It accepts only a single operand and converts that operand into its Boolean representation, then inverts it, so that truthy items become false and falsy items become true:
!1; // => false!true; // => false!'hi; // => false!0; // => true!''; // => true!true; // => false
Internally, the NOT operator will perform the following:
As discussed in the Conversion to a Boolean section in the last chapter, a typical idiom for converting a value to its Boolean representation is the double NOT (that is, !!value) as this effectively reverses the truthiness or falsiness ...
Read now
Unlock full access