Can Someone Explain This ( !! ) Operator
Angular 6 is here already, so in short tutorial provided by Medium i founded this lines of code. else if (!!this.day4Name && !this.day5Name && days[date] !== this.d
Solution 1:
!!
represents a double negation, you're basically calling the not operator twice.
It's useful if you want to force a cast from any type to a boolean
e.g.
var somethingTruthy = {};
somethingTruthy = !!somethingTruthy //force cast to boolean
console.log(somethingTruthy); //print true
or
var somethingFalsy = "";
somethingFalsy = !!somethingFalsy //force cast to boolean
console.log(somethingFalsy); //print false
Post a Comment for "Can Someone Explain This ( !! ) Operator"