In JavaScript, what does the '!!' operator do? Is it a NOT NOT statement?
For example:
someFunc(foo) {
    return !! foo;
}
// Return foo only if foo exists?
In JavaScript, what does the '!!' operator do? Is it a NOT NOT statement?
For example:
someFunc(foo) {
    return !! foo;
}
// Return foo only if foo exists?
 
    
    First this is not an operator.converts it to boolean in javascript
EXAMPLE:
var test = true;
!test = false; //It will converted to false
!!test = true; //Again it will converted to true
 
    
    ! is the "not" operator, casting its one argument to a boolean and negating it.
The second ! negates it back, so effectively !! casts the value to a boolean.
 
    
    Converts foo to boolean.
var foo = "TEST";
!foo // Result: false
!!foo // Result: true
