Confused on Understanding Uninitialized Variables

Tell us what’s happening:

Your code so far


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

var a = 5;
var b = 10;
var c = "I am a!"

Your browser information:

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

Challenge: Understanding Uninitialized Variables

Link to the challenge:

The challenge says - Initialize the three variables a , b , and c with 5 , 10 , and "I am a" respectively so that they will not be undefined . So when I write the below:

var a = 5;
var b = 10;
var c = “I am a!”

How I am wrong?

1 Like

You need to only change code between the line

// Only change code below this line

and

// Only change code above this line

You are confusing the computer.

I did that now.

// Only change code below this line

var a = 5;
var b = 10;
var c = “I am a!”;

// Only change code above this line

for - Initialize the three variables a , b , and c with 5 , 10 , and "I am a" respectively so that they will not be undefined .

I get the result

// running tests
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 “I am a String!”
You should not change code below the specified comment.
// tests completed

Why?

var a = 5;
var b = 10;
var c = "I am a!";

Did you restore the code below the Do Not Change line? You can always reset the challenge to fix that.

The code you have above is close, with the exception of a small typo in the string for c (punctuation!).

Thank you, the problem is solved. I am on the next set now.

2 Likes