Stuck


#1


25 More variable Practice (Javascript)

Error Message: Oops, try again. It looks like you didn't log the length of myCountry to the console.

My Code:

var myCountry = "New Hampshire";
console.log( "myCountry".length); 
console.log("myCountry".substring(0,3) );

What did I do wrong? The "Hint" didn't help:

Note that "New York" and "new york" are seen by the computer to be different strings. (i.e. "New York" is not the same as "new york")

#2

myCountry and "myCountry" are not the same things.

myCountry is a variable name and in the code that you've shown it has a value of "New Hampshire".

"myCountry" is a string which is just as it is: "myCountry"

To see for yourself try printing them both:

console.log("myCountry");   // myCountry
console.log(myCountry);    // New Hampshire

Do you see how that works now?


#3

Ohhhh, thanks for telling me. I get it now. So what I did wrong was that I wrote: myCountry instead of: "myCountry".


#4

What you did wrong was the opposite of that.


#5

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