Lesson 25 - Variable not defined error


#1

Hi Guys,

Having trouble in lesson 25 of JavaScript.

// Declare a variable on line 3 called
// myCountry and give it a string value.
var MyCountry = "Czech";

// Use console.log to print out the length of the variable myCountry.
console.log(myCountry.length);

// Use console.log to print out the first three letters of myCountry.
console.log(myCountry.substring(0,3));

Yet I keep getting this error: "ReferenceError: myCountry is not defined"

I looked through this forum and it seems like I'm either blind or I did define the variable myCountry...

Thanks for any help!


#2

no, you didn't, because when you define myCountry:

var MyCountry = "Czech";

you have the M uppercase, when you try to access the length and sub-string, you use lowercase m

variable names are case sensitive.


#3

oh wow, I knew it would be something silly! Thank you so much for your help!


#4