I cant solve my JS puzzle am I so stupid?

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!";
a = 6;
b = 15;
c = I am a String!;

a should be defined and evaluated to have the value of 6
b should be defined and evaluated to have the value of 15
c should not contain undefined and should have a value of "I am a String!"
Do not change code below the line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

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

First why did you changed the code below the line? leave them as they are like following

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

Now this is simple, needs some quick math, and string concat.
You need to change these lines(above the commend)

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

Now specify correct initial value for a,b, and c to get desired output asked.

Go for it, happy programming

1 Like

I cant solve it…i am too stupid, my first day with JS

Here is what I have

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

a = 5;
b = 10;
c = I am a;

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

a should be defined and evaluated to have the value of 6
b should be defined and evaluated to have the value of 15
c should not contain undefined and should have a value of “I am a String!”
Do not change code below the line

Almost done, only one issue.

Your string (variable c), the content should be inside a pair of double-quotes “”
change
c = I am a;
to
c = “I am a”;

give it a try.

ok I solved this one, thank you, next one please

In line 1 where initialize these 3 variables is written, just below this line only variables were there or created but they were not defined. Now, I have defined assigning values in these lines only. And, in the lines 8, 9 and 10 (below mentioned thing is given
a = a + 1;
b = b + 5;
c = c + " String!";
Now my question is why are we manually writing in the lines 11, 12 and 13 that
a = 6
b = 15
c = “I am a String!”
and then submitting the result and it is showing okay .
If we have already assigned values then we should be doing it clicking on any button or giving a command and then values (final) will automatically get reflected beside those variables.

It is not ok, you shouldn’t add anything below the line.

4 posts were split to a new topic: Help with unitialized variables