25 more variable practice need help please


#1


var myCountry = "New York";

console.log("myCountry".length);

console.log("myCountry".substring(0,3));


#2

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"


#3

Thanks I got it know

it is

var myCountry = "New York";

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

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


#4

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 " "


#5

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


#6

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


#7

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.


#8

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