Basic JavaScript - Compound Assignment With Augmented Addition

Tell us what’s happening:
Help…I feel very dumb because I don’t understand anything on this step…
Describe your issue in detail here.

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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Compound Assignment With Augmented Addition

Link to the challenge:

If you want to add 27 to x, you can do it like this:

let x = 5;
x = x + 27;
console.log("x equals " + x);
// x equals 32

But since we increment values so often, we like to use the += operator as a shorthand. Instead of x = x + 27, we can enter x += 27 and get the same result. In other words, x += 27 is equivalent to x = x + 27.

Knowing that, can you simplify the line a = a + 12; using the += operator?

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