freeCodeCamp Challenge Guide: Understanding Uninitialized Variables

Understanding Uninitialized Variables


Hint 1

Make sure that the variable has the correct data value. Leaving a variable uninitialized, meaning you do not give it a value, can cause problems if you want to do operations on it.


// Initialize these three variables
var a;
var b;
var c;

// Do not 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”;

What is wrong with this?

1 Like

var c should be initialised before it is used since it is a string. try initialising it right after declaration

it should be -

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


on var c should add ! after String. should be all set!