Initialize these three variables

Tell us what’s happening:
hi i am trying any thing but it just giving me error i wont let me to initialize the variable c to a string saying i am a string!

helpppppppppppppp please

Your code so far


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

var a = 5;
var b = 10;
var c = "i am a" ;

// 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; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0.

Challenge: Understanding Uninitialized Variables

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables

The challenge is trying to teach you the difference between declaring variables and initializing variables. When the challenge first loaded, you had:

var a;
var b;
var c;

Those are variable declarations. There are no values assigned to them at this point.

You are supposed to initialize those variables. Initialization is when you assign a value to a variable at the same time it is declared.

You should not both declare a variable and then later initialize variable. Reset the code and try again.

1 Like