double exclamation mark js code example
Example 1: javascript on double click
document.getElementById("myBtn").addEventListener("dblclick", function() {
alert("Hello World!");
});
Example 2: double exclamation mark js
!!false === false
!!true === true
!!0 === false
!!1 === true
!!parseInt("foo") === false
!!-1 === true
!!(1/0) === true
!!"" === false
!!"foo" === true
!!"false" === true
!!window.foo === false
!!null === false
!!{} === true
!![] === true
Example 3: javascript double question mark
let a = null;
const b = a ?? -1;
console.log(b);
let a = 9;
const b = a ?? -1;
console.log(b);
Example 4: es6 what is double exclamation operator
!oObject
!!oObject
Example 5: javascript operator double not
!!0
!!""
!!null
!!undefined
!!NaN
Example 6: javascript double exclamation mark
const isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);
console.log(isIE8);