This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by MgTheCar
about 9 years

25/28 Help ASAP Error "myCountry Is undefined"What im i Doing Wrong

// Declare a variable on line 3 called // myCountry and give it a string va //var myCountry = “America”;

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

Answer 54c29d8d9113cbb2d500238a

5 votes

Permalink

Remove the // from //var myCountry = “America”;

points
Submitted by tony de araujo
about 9 years

4 comments

Lloyd Lopes about 9 years

var myCountry = “Canada”; console.log(myCountry.length); console.log(“Canada”.substring(0,3

tony de araujo about 9 years

Hi Lloyd, using “Canada”.substring(0,3) in the console.log will work but that’s not what the author is looking for. He wants the variable instead of the value. The idea is to code as generically possible so it becomes portable.

Lloyd Lopes about 9 years

still learning. but i did try it with the variable it gives me an error

tony de araujo about 9 years

Make sure the variable is NOT wrapped in quotes. If you still have problems past your code on the bigger window at the bottom of this page and I will test it for you.