# Unsure what I'm doing wrong

I’ve tried multiple different things, can’t get the first 3 check marks to appear after doing what I think is right. I need help understanding this in general

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

// Only change code below this line
a += 3 + 12;
b += 9 + 17;
c += 12 + 7;
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36`.

Challenge: Compound Assignment With Augmented Addition

You should not have added the extra numbers, it should just be 12, 9, and 7. What you’ve written is a valid operation, but it is not what the test wants. The test say what they expect `a,b,c` to be assigned to so you should `console.log(a,b,c)`, and see what their values are

2 Likes

Having the += sign means adding the left side to the right side. So what you’re having here is that you’re adding a + 3 + 12 which makes your a now equal to 3 + 3 + 12 whick is 18.

Instead of having redundant variables on the same line, your test expects you to simplify the operation by adding the value of the given variable to a certain number. Kindly look closely at the example :

``````var myVar = 1;
myVar += 5;
``````

myVar is now equal to 6
If you make it:

``````var myVar = 1;
myVar += myVar + 5;
``````

myVar is now equal to 7

a += b is equivalent to, or shorthand for, a = a + b. So, if you want the effect of

``````let a = 3;
a = a + 5; // a is 8 now
``````

you can write

``````let a = 3;
a += 5;
``````

When you write

``````let a = 3;
a += 3 + 5; //now a is 11
``````

you are doing

``````let a = 3;
a = a + (3 + 5);
``````

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.