25 More Variable Practice


#1

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "America"
"America".substring(0,5)

// 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));

It says I didn't log the length into the console, what do I do???



#2

These are two different things:

myCountry  // a variable currently set to "America"
"myCountry" // a string consisting of the letters myCountry

Make sure you use the one that does what you want.


#3

Thanks so much, it worked!!


#4

what did you change i need help also


#5

Since you've set a value for var

myCountry --- no quotes
console.log(myCountry.length);
console.log(myCountry.substring(0,3));


#6

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