Problems with Uninitialized Variables

Good nights,
Dear All,

I have been trying to solve part of the test of the topic Uninitialized Variables,
i can´t solve the following challenge:

c should not contain undefined and should have a value of “I am a String!”

I will appreciate and thank so much all the orientation provided, thanks in advance to you all,
Kind regards,

Your code so far

// Initialize these three variables
var a;
var b;
var c;
var a=5;
var b=10;
var c= c + "I am a String!";

// 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36.

Link to the challenge:

So you need to initialize the variable “c” with “I am a” only. The bottom equation (c = c + " String"!)will then equal “I am a String!”.

Dear MarcelPenn ,
thank you so much for the advise, is it right the code below :
i better attach you a picture about it.
I will appreciate and thank you so much your orientations and advises,
Kind regards,

For the initialization of the variables you do not need to declare it again. For example,

If you have “var a”. To initialize it you don’t have to retype “var a” but just assign it the value. That is to say:

var a;
var b;
var c;
a = 5
b = 10

Am I clear? On the other hand, on the variable c they give you a small instruction that is already initialized with the word “String” that implies that you have to initialize it only with the word “I am a”. For example

c = "I am a";

The rest of the code is

c = c + "String"

Their intention is to make you understand two things:

  1. The initialization of the variables
  2. The concatenation of the variables.


Dear lereboursx,

i appreciate and thank you so much for your kind help and orientation,
i am happy to be part of this forum already :slightly_smiling_face:
kind regards,

Very close. You don’t need line 8, because it’s already there for you on line 13.

Thank you guys finally i did it !!! i feel so relieved !!! :slightly_smiling_face: thank you both MarcelPenn and lereboursx

an extra thing
initialisation is assigning a value to a variable on the same line it is declared

var d; // declaration
var d = 3; // initialisation
d = 3; // assignment 

Dear ielahleen,
Good mornings,

Thank you for the reply and orientation, i just have a questions, do we need to end the statement in
a declaration, initialisation and an assignment with a semicolon ?

Thanks in advance :slightly_smiling_face: