Can someone please help it says use the hint but the hint isn't helping
It looks like you are trying to use a variable before defining it. The checker wants you to define the variable first before you use it. You are currently using it on line 3 and defining it on line 4. Define it on line 3 and then use it on line 4 instead.
Next, remember learning about
.length - if you add it to a variable, it gives you the length of it's contents. Instead of making a variable with a static string, log to the console the length of the contents of the variable you created on line 3 ->
Finally, take a look at the last one, think about what exactly you're telling the computer to do. It's telling you to get the first 3 letters of
myCountry the variable you created, not a string.
Let me know if that works.
For the first exercise, you're assigning the variable
myCountry the length of the string "Canada" which would be 6. So if you use
myCountry it would spit out the value of
You need to assign that only a value, not use the .length string property. (not yet anyways).
For exercise two, I'm not sure why you're using
var in front of
myCountry - you already created that variable on line 3. You only need to log the length of the variable, you're almost there.
For the final exercise, you need to print out the first 3 letters of the variable
myCountry - again, you're using a string instead of the variable. I'm happy you tried though!
console.log(myCountry.substring(0,3)); is what you should be using instead.
Let me know if that helps
That Worked thanks
var myCountry = "Cananda";
// Use console.log to print out the length of the variable myCountry.
// Use console.log to print out the first three letters of myCountry.
//this is the way i did it and it is green
Hi Alan, we can always use more helpers here, so thank you for responding.
Don't worry if you are also a new programmer, answering questions is a great way to make sure that you understand what you are learning.
3 posts were split to a new topic: Lesson 25 More Variable Practice Help
Lesson 25 More Variable Practice Help
thanks it helped me too
NVM!!! I've figured it out...
2 posts were split to a new topic: 25. it looks like myCountry is not a string" or it says "undefined."