#25 Variables.Help I'm stuck!


#1

https://www.codecademy.com/en/courses/getting-started-v2/4/2?curriculum_id=506324b3a7dffd00020bf661#


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.


#2

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));.


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


#4

Thank You!

It worked!

Appreciate your help.


#5

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