!(NOT) Operator
!(NOT) Operator reverses the boolean result of the operand (or condition). It first converts the operand to a boolean type and then returns its flipped value.
Example: In this example, we will perform the NOT operation on number multiple times.
// !(NOT) operator
let i = 0;
console.log((!i));
console.log(!!i);
Output:
true
false
Explanation: Since zero is treated as a falsy value therefore NOT operation on zero will return true and when this operation is performed again we get true as output.
Contact Us