Help solve my JS Puzzle on Understanding Uninitialized Variables

What am I doing wrong?

  • a should be defined and have a final value of 6.
  • b should be defined and have a final value of 15.
  • c should not contain undefined and should have a final value of the string I am a String!

My answer
// Only change code below this line

var a = 6;

var b = 15;

var c = “I am a String!”;

// Only change code above this line

a = a + 1;

b = b + 5;

c = c + " String!";

If you console.log the values of a, b and c variables, what do you see in the displayed variable values (after the statement c = c + " String!";) ?

I am a beginner learning JS from this platform. I don’t understand what you mean. Also I should not change the code below as indicated, so c = c+ “String!”; is below.

I should only change this code and that’s where am stuck
// Only change code below this line

var a = 6;
var b = 15;
var c = “I am a String!”;

So, what happens after the a = a + 1; statement is executed in your code? What would be the value of the variable a?

I have seen where I was wrong. This has been resolved.

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