How to Define and Re-assign Variables

Tell us what’s happening:

Your code so far

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Compound Assignment With Augmented Addition

Link to the challenge:

a = a + 12; var a += 9

In this line, you are adding 12 to a and then attempting to redefine a and add 9 to its value. I’d look closely at the example:

var myVar = 1;
myVar += 5;
console.log(myVar); // Returns 6
1 Like

Hi, I’ve changed your thread title to describe your problem more clearly. Descriptive titles, such as “Why does my function return undefined?”, are more likely to elicit helpful responses than generic titles, such as “Help please”.

Also, for future posts, please include information in the Tell us what’s happening section, as you have not actually asked anything in this post…

Help us help you.