double exclamation in javascript code example

Example 1: es6 what is double exclamation operator

!oObject  // inverted boolean
!!oObject // non inverted boolean so true boolean representation

Example 2: javascript operator double not

// convert to boolean 
// The following examples are the only values which result in a false expression

!!0 // false
!!"" // false
!!null // false
!!undefined // false
!!NaN // false

Example 3: javascript double exclamation mark

const isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);  
console.log(isIE8); // returns true or false

Example 4: javascript double exclamation mark

!oObject  // inverted boolean
!!oObject // non inverted boolean so true boolean representation

Example 5: javascript double exclamation mark

console.log(navigator.userAgent.match(/MSIE 8.0/));  
// returns either an Array or null

Example 6: javascript double exclamation mark

console.log(!!navigator.userAgent.match(/MSIE 8.0/));  
// returns either true or false