-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
  • 120,386
  • 19
  • 245
  • 237
tallandroid
  • 686
  • 1
  • 7
  • 8

1 Answers1

3

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

Matt Herbstritt
  • 4,362
  • 2
  • 21
  • 26