Variables? 25 and 26


I had a hard time with lesson 25 but executed the program like so:

var myCountry = "The United States of America";
console.log("The United States of America".length);
console.log("The United States of America".substring(0,3));

It passed.

Then onto 26 and wrote my program in similar fashion and it too passed:

var myName="Ariana";

My question is where are we storing variables if it's not to recall? When I was doing lesson 25. I was under the impression it should have been:

var myCountry="The United States of America";

As in by defining the variable, the value had been stored. Meaning (as per the lesson) I would be able to use the shorter "myCountry" vs "The United States of America." If I have to type out "USA" every single time, that's not easier than just inputting the variable. Same with lesson 26. Am I really updating the value if I have to manually print which value I want every single time? Maybe I'm thinking too basically but as I peruse through these forum post, I see a lot of students having the same "Variable" issues.


The value was stored in the myCountry variable.

var myCountry="The United States of America";

Instead of using the myCountry variable, you instead used a string "myCountry".

The correct way to log the myCountry variable is like this:



Ahh, so I used a string instead of the variable. Then does that mean the program is judged only on output rather than written code? Based on your explanation, I did not do the assignment as it should have been written.

Thank you for the clarification. The error code it was giving me was throwing me for a loop!!


Thanks! That was super helpful!!


The code checker is far from perfect :slightly_smiling:

It is good to look at your program and the results and decide for yourself if they seem reasonable.

Always ask if you have doubts. :green_heart:


A post was split to a new topic: 25. This is how i made through!