Understanding Uninitialized Variables – freeCodeCamp

When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means “Not a Number”. If you concatenate a string with an undefined variable, you will get a literal string of undefined.

// Only change code below this line
var a;
a =5;
var b;
b=10;
var c ="I am a";
// Only change code above this line

a = a + 1;
b = b + 5;
c = c + " String!";
Share on:

Leave a Comment

Your email address will not be published.

error:
Scroll to Top