What is difference in between !!user.rank and !user.rank
<div ng-show="!!user.rank">
Rank: {{user.rank}}
</div>
<div ng-show="!user.rank">
<button class="btn btn-success" ng-click="KnightMe(user)">Knight Me</button>
</div>
What is difference in between !!user.rank and !user.rank
<div ng-show="!!user.rank">
Rank: {{user.rank}}
</div>
<div ng-show="!user.rank">
<button class="btn btn-success" ng-click="KnightMe(user)">Knight Me</button>
</div>
! is not operator
!! casts something to truthy / not truthy
var foo = 0;
console.log(!!foo);
//false
!
converts Object to boolean. If it was falsey (e.g. 0, null, undefined, etc.), it will be false, otherwise, true.
!oObject //Inverted boolean
!!oObject //Non inverted boolean so true boolean representation
So !! is not an operator, it's just the ! operator twice