Compound Assignment With Augmented Addition 1 - Help please

Tell us what’s happening: The 4th line says “You should use the += operator for each variable”

a should equal 15
b should equal 26
c should equal 19
You should use the += operator for each variable
Do not modify the code above the line

Your code so far

var a = 3;
var b = 17;
var c = 12;

// Only modify code below this line

a = a += 12;
b = 9 += b;
c = c += 7;

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.189 Safari/537.36 Vivaldi/1.95.1077.60.

Link to the challenge:
https://www.freecodecamp.org/challenges/compound-assignment-with-augmented-addition

When you use +=, you don’t need to restate the variable. For example, instead of

a = a + 5

you write

a += 5

you don’t write

a = a += 5

It’s just a shorter way to write it - the first two examples mean the exact same thing. It used to be (back in the days of assembly), if I’m remembering correctly, that the second one was actually a tad faster, but I don’t know if that is still true, and it doesn’t really matter for a non-math-optimized language like JavaScript - it’s just less typing and easier to read once you know what it is.

1 Like

Escellent Thank you

I just got it figured out after about 45 mins trying :slight_smile: