Double not `!!` operator in JavaScript?
The !
in JavaScript, also called bang
, is the logical not
operator. If you place this operator in front of a boolean value, it will reverse the value, returning the opposite.
However double not !!
The operator can use any kind of value like string or number. If You can use “!!” in condition, if you have value then the True will return and if not then False.
var textValue = "Hello";
if ( !!textValue ) {
console.log( 'This is true' );
} else {
console.log( 'This is false' );
}