10

Title is most of the question, what allows this to be valid code? Is there any benefit or trick that would allow me to utilize this?

Charles
  • 50,943
  • 13
  • 104
  • 142
Dested
  • 6,294
  • 12
  • 51
  • 73

2 Answers2

17

The unary plus operator has higher precedence than the addition operator, just split your expression into multiple grouped expressions and it will seem pretty obvious:

var m = 6 + ( +( +( +( +( +( +( +( 6 ))))))));
      //6 + 6
Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838
3

The extra pluses are being treated as positive indicators. As in +1.