This forum is now read-only. Please use our new forums! Go to forums
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
Remove the //
from
//
var myCountry = “America”;
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
4 comments
var myCountry = “Canada”; console.log(myCountry.length); console.log(“Canada”.substring(0,3
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.
still learning. but i did try it with the variable it gives me an error
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.