In programming, it is common to use assignments to modify the contents of a variable. 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 . Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step.
One such operator is the += operator.
let myVar = 1;
myVar += 5;
console.log(myVar);
6 would be displayed in the console.
Convert the assignments for a , b , and c to use the += operator.
let a = 3;
let b = 17;
let c = 12;
// Only change code below this line
this is my answer below, still, I’m getting error message,
a += 15;
…no… The instructions want you to change zero numbers. The instructions want you to use the exact same numbers but with the compound assignment syntax instead of the current syntax.
And I am saying that nowhere in the challenge link do the instructions say to use those numbers.
This just is not true.
a is initialized to 3. Then a has 12 added to its value. At no point should 15 be added into the value stored in a. The challenge only wants users to change the syntax that is used to add 12 to the initial value of 3.
i wasn’t giving him an answer i was simply responding to where the numbers are coming from, the person above asked where he is getting those numbers from and i responded that they’re coming from the link itself where it says that the code needs to equal 15, 26, and 19.