I am currently stuck with this


Anyone can help me with this question.
Initialize the three variables a , b , and c with 5 , 10 , and "I am a" respectively so that they will not be undefined .

a should be defined and evaluated to have the value of 6 .


b should be defined and evaluated to have the value of 15 .


c should not contain undefined and should have a value of the string I am a String!

Your code so far

// Initialize these three variables
var a = 5;
var b = 10;
var c = "I am a String!";

// Do not change code below this line

a = a + 1;
b = b + 5;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15

Challenge: Understanding Uninitialized Variables

Link to the challenge:

HI @Calum !

Welcome to the forum!

I would reset the lesson because it looks like you are missing this line at the bottom.

c = c + " String!";

I don’t see that in your code here

When you reset the lesson you should have this as the starting code.

// Only change code below this line
var a;
var b;
var c;
// Only change code above this line

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

Once you fix that issue, you did this part correctly.

But this is wrong.

The direction want you to initialize the variable c with “I am a”.
You are not supposed to add the word String at the end.

Reason being is because that is what his line of code is doing .

c = c + " String!";

That line of code translates to

c = "I am a" + " String"

Hope all of that makes sense!

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