Basic JavaScript - Compound Assignment With Augmented Addition

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

Convert the assignments for a , b , and c to use the += operator.
Please this was what i was asked to do but i don’t know why i wasn’t able to pass this level.
Please someone should help me out.

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 13; SM-A047F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Mobile Safari/537.36

Challenge: Basic JavaScript - Compound Assignment With Augmented Addition

Link to the challenge:

This looks different from the other two. Spell it out, what this means is:

9 = 9 + b; 

Can the number 9 really also be equal to the number 9 plus some other number stored in b (other than 0)? That’s like saying that 10 is equal to 20.

1 Like

But my answer didn’t passed.

I don’t understand what it expect me to do. I have checked other people question forms and this is the right answer that i did but i didn’t pass.

Tell us what’s happening:
Describe your issue in detail here.
This was the instruction below.
Convert the assignments for a , b , and c to use the += operator.
But i did exactly what i was asked to do but i don’t know why i wasn’t able to pass and it was saying i should use the =+ signs in each variable when i already did.
Your code so far

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Compound Assignment With Augmented Addition

Link to the challenge:

So given the += operator, what do you think it is actually doing? If we have

let a = 5;

// and later...
a += 12;

In that case, what does the “plus equals” mean?

Sorry i did changed my answer to
a += 12;

9 += b;

c += 7;
but i didn’t pass. Can you help me out.

What is the difference between

9 += b;

and

b += 9;

The left side is always what we are assigning a value to. The right side is the value we are assigning.

Can we assign a value to 9?

Thank you so much, I didn’t knew it was 9 +=b; was where i was wrong.

1 Like

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