Understanding Uninitialized Variables(new to us)

**Tell us what’s happening
Hi everyone
I,m new to JavaScript and I,m kind of stuck here I can,t figure out what’s wrong with my code; Can anyone plz guide me.

Your code so far

// Initialize these three variables
var a;
var b;
var c;
var a = 6;
var b = 15;
var c = “I am a String!”;
// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

Your browser information:

User Agent is: Mozilla/5.0 (iPad; CPU OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1.

Link to the challenge:

So the variables are already declared here for you with a “undefined” value. The challenge is to initialize them with the given values. I don’t want to give too much away, lmk if you need more help!


Everything that you are supposed to do in a challenge is below the gray line (horizontal rule) and above the Run the Tests button. So it looks like you are initializing to them to what they should be when the rest of the code runs, instead of the values it tells you to.

1 Like

You need to change the three existing lines: variables are declared with var the first time they appear, so it should appear only once per variable. Plus you need to initialize them, and that means giving them a value on the same line they are declared

1 Like