#25 Variables.Help I'm stuck!



Here is what I have

// Use console.log to print out the length of the variable myCountry.
console.log ("myCountry".length);
var myCountry = "Denver";
// Use console.log to print out the first three letters of myCountry.
console.log ("Denver".substring(0,3) );

The code shows up correctly in the screen on the right but I keep receiving this message: "Oops, try again. It looks like you didn't log the length of myCountry to the console."

I cannot for the life of me figure out what is missing.

Replace this line with your code.


Your code is fine but not right for the question.

You need to use your variable here making it console.log(myCountry.substring(0,3));.


It appears that on your first console.log() statement, you typed the variable name in quotes. This will tell the system that it needs to find the length of "myCountry" instead of "Denver". If you remove the quotes, it will print the length of "Denver". A variable is not interpreted as a variable when incorporated in a string. Also, declare the variable before logging the length of it.


Thank You!

It worked!

Appreciate your help.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.