Basic JavaScript - Compound Assignment With Augmented Addition

Hello there I am having some issues with this excersice and I can not continue to the next step. i having issues completing this step: You should not modify the code above the specified comment.

let a = 3;

let b = 9;

let c = 6;

// Only change code below this line

a += a + 9;

b += 8 + b;

c += c + 7;


Hi! Welcome to the forum! Please link to the lesson in future, it makes it easier to help.

You’ll need to reset this lessons code to start with. Because as the message says, you’ve edited code above the comment. This isn’t what you should do to pass this challenge.

Once you’ve reset the code you need to read this part of the instructions again and look at the example.

Remember that everything to the right of the equals sign is evaluated first, so we can say:

myVar = myVar + 5;

To add 5 to myVar.

If we look at the original lesson code it is using the same method to add a number to a, b and c.

a = a + 12;

b = 9 + b;

c = c + 7;

If we go back to the lesson example, it shows how 5 can be added to myVar using the += operator.

myVar += 5;

So, the examples need to be changed to use the += operator in the same way as it is used in the example to add 5 to myVar.

1 Like

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