I'm a bit confused with the += sign. How does it work?
1 += 2 // equals ?
1 += 2
and this
var data = [1,2,3,4,5]; var sum = 0; data.forEach(function(value) { sum += value; }); sum = ?
1 += 2 is a syntax error (left-side must be a variable).
x += y is shorthand for x = x + y.
x += y
x = x + y
2.1m questions
2.1m answers
60 comments
57.0k users