Understanding Uninitialized Variables wow

Tell us what’s happening:

Your code so far

// 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!";

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

You haven’t asked a question about the topic.

Maybe you are confused about the difference in initialized variables and uninitialized variables?

If so, then consider the following example code which declares a variable named myVar.

var myVar;

The above code declares myVar, but because it was not also assigned a value at the same time it was declared, it is what as known as uninitialized. However, in the following code, the variable myVar is declared and assigned a value. This is what is known as initializing a variable.

var myVar = 'some value';

So, uninitialized variables have been declared, but not assigned a value and initialized variables have been declared and assigned a value.

1 Like