-1

Maybe I am too quick in asking this question , but I was going through angular code and I found the logical expression evaluation like this : https://github.com/angular/angular.js/blob/master/src/ng/directive/attrs.js#L362

Essentially an attribute was evaluated like :

attr.$set(attrName, !!value);

Is there a particular reason why was this done this way ?

PSL
  • 123,204
  • 21
  • 253
  • 243
tallandroid
  • 726
  • 1
  • 7
  • 8

1 Answers1

3

!! is a concise way of ensuring that value will be a boolean.

Matt Herbstritt
  • 4,754
  • 4
  • 25
  • 31