Java Script var a,b and c

Tell us what’s happening:
I don’t understand what i have to do

Your code so far


// Only change code below this line
a = a + 1;
b = b + 5;
c = c + " String!";

var a = 6;
var b = 15;
var c = “I am a”;
// Only change code above this line

Your browser information:

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

Challenge: Understanding Uninitialized Variables

Link to the challenge:

It looks like you moved the code from below the “Only change code above this line” and moved it to the top of your code? That should just have been left alone. Your code now tries to change the variables before they have been created (it is the var keyword that creates the variable).

The other problem is with your variable c. I’m guessing that you are using an Apple device, because those fancy curly quotes are not actual double quotes. If you’re on an Apple device, you need to turn off “smart punctuation” or it will change some of your punctuation marks.

What you did wrong is you declared the variables after you added on to them.
You have to define them first:

//Only change code  below this line
var a = 6;
var b = 15;
var c = “I am a”;

Then you change them by adding numbers and strings to them:

a = a + 1;
b = b + 5;
c = c + " String!";
// Only change code above this line

The reason why you do this is because you can’t use variables ‘a’, ‘b’, and ‘c’ if they don’t exist.