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,010
  • 13
  • 100
  • 141
Dested
  • 6,114
  • 11
  • 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ó
  • 769,263
  • 179
  • 909
  • 832
3

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