Compound Assignment With Augmented Addition - Task confuses me!

Compound Assignment With Augmented Addition - Task confuses me!
0.0 0

#1

Tell us what’s happening:

Sorry, I’ve no solution to this task. Can someone help me or let me know, ho to solve this.
thks, Orion482!

Your code so far


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

// Only modify code below this line

a = += 12;
console.log(a);
b = += 9;
console.log(b);
c = += 7;
console.log(c);



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; rv:60.0) Gecko/20100101 Firefox/60.0 anonymized by Abelssoft 180910037.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition/


#2

You need to replace the “=” with “+=”. Like this:

a += 12;

#3

thks for your reply. zdflower, but I#m afraid I#m still don’t know the answer to that, I wrote:

a += 12; b+= 9; c += 7; is that right? can you confirm that pl? Thks for help, I think …I’ve used one “=” twice.


#4

Yes it’s ok.
a += 12 is another way to say a = a + 12. Like "add 12 to the value of ‘a’ and then assign the result to ’ a’’ .

Where have you used “=” twice?

There is the assingment operator “=”, and on the other hand are the comparison operators “==” and “===”. You must not confuse them.


#5

thks again for your explained reply,zdflower, by “twice” i only meant that I used the “=”-operator at two posiitions in my earlier-false code: a = += 12; this is obviously undefined. But anyway tkhs that you explained me the differrence bewtween assignment- & comparison-operator with your example! Sometimes the solution is in front of programmers’ eyes, but simply hidden in that moment.


#6

You’re wellcome. You could read more about javascript operators here: https://www.w3schools.com/js/js_operators.asp