0

Can someone explain this to me? It's about operators in javascript.

I've seen a sample code like c += a + (+b)

Is this the correct equivalent? c = c + a + (+b) ?

I can understand the rest except that +b, why does it have a + in b?

meetmahpuppy
  • 418
  • 1
  • 4
  • 17
  • 1
    See *unary plus* here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators – Alex K. Sep 17 '14 at 14:12
  • 1
    And to answer the part of the question that isn't addressed in the duplicate, yes, `c += …` is equivalent to `c = c + …`. – p.s.w.g Sep 17 '14 at 14:15

0 Answers0