Can anyone explain, the difference between
<div ng-show="!user.name">
and<div ng-show="!!user.name">
I was wondering what
!!
does? in angularjs I googled it but didn't get relivent answer
It is a double logical not operator.
true
evals to true
!true
evals to false
!!true
evals to true
!!!true
evals to false
....and you can keep going if you want.
The main use of !!
generally is to take a truthy value and have it result in a boolean true
or false
.
logical not operator
!
Returns false if its single operand can be converted to true; otherwise, returns true