Pls, help i'm stuck ! i don't know how to do a Compound Assignment With Augmented Addition

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

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




phucdfx12093@funix.edu.vn

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36</code>

**Challenge:**  Compound Assignment With Augmented Addition

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition

This is the correct solution for a.
You have similar lines for b and c.
That’s the solution.

Remove all other lines below the “only change code here” section apart from the 3.
Right now you have the old calculation there, which are wrong for the task.
And you declare the variables again, which you shouldn’t do.

you mean this ?
let a = 3;

let b = 17;

let c = 12;

a = a + 12;

b = 9 + b;

c = c + 7;

a += 12;

b += 9;

c += 3;

still incorrect pls check for me thank you

This code still contains the “how we used to add” lines → you gotta remove them.
The task was to replace the old addition (a=a+12) with the new (a+=12).
Hence the test checks if you actually removed the old ones.

Also make sure you add the correct numbers (looking at c).

You are supposed to replace the “old” standard addition with the new += form. Replace them, don’t add them on the end. Another way would be to just remove the old ones from what you have.

When I remove the old addition lines (the middle 3) and fix the math for the “c” problem, your code passes for me.

1 Like

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