Computer Science, asked by Applecookie8820, 11 months ago

What is the !! (not not) operator in JavaScript?

Answers

Answered by saranyaammu3
0

Answer:

The double negation(!! ) operator is the! Operator twice and calculates the truth value of a value. It returns a Boolean value, which depends on the truthiness of the expression.

Consider (!!p) as !(!p), here’s an example:

If p is a false value, !p is true, and !!p is false.

If p is a true value, !p is false, and !!p is true.

Here’s another example:

0 === false is false.  

!!0 === false is true.

!!0 === false  

!!parseInt("foo") === false  

!!1 === true  

!!-1 === true

!!false === false  

!!true === true

Explanation:

Similar questions