I cant solve my JS puzzle am I so stupid?

I cant solve my JS puzzle am I so stupid?
0

#1

Tell us what’s happening:

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

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`.

#2

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

#3

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

#4

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.

#5

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

#6

I know you said you solved this challenge, but I wanted to emphasize something you are missing which will simplify your code. The previous challenge named Basic JavaScript: Initializing Variables with the Assignment Operator explains exactly how to initialize variables.

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

All you have really done is declare variables a, b, and c and then on separate lines assigned them values. Your code passes the tests probably because the tests are not as robust as they should be. If you truly are initializing a variable, the assignment takes place on the same line as the variable declaration (see example below):

``````var myInitializedVariable = "some assigned value";
``````