25 more variable practice need help please


var myCountry = "New York";




so once you create a variable like myCountry its like telling the computer that this text (myCountry) is now going to mean this ("New York")

so when you go to use the variable later you just use myCountry but it cant be a "string"


Thanks I got it know

it is

var myCountry = "New York";

console.log("New York".length);

console.log("New York".substring(0,3));


that will give you the same result but that's not how you use the variable.

you need to console.log() the variable name, not its value. so instead of New York put the name of the variable which is myCountry. make sure you don't put the name in " "


you were really close with what you had originally, you just need to delete the " " around myCountry in the console.log()


for some reason It work when I place the value instead of the variable


it technically will pass because the myCountry variable is set to New York. but what they want you to do is get in the habit of using the name that you set in the variable. this is important in a situation where your variable is really long or complicated so its easier to make a name for it.


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