freeCodeCamp Challenge Guide: Understanding Uninitialized Variables

Understanding Uninitialized Variables


Hints

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.

20 Likes

// 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?

21 Likes

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

9 Likes

it should be -

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

30 Likes

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

8 Likes