Plz help me with no. 25


#1

ive looked at every post that has an answer to 25 and ive copied it down. but it still wont work! plz point out any mistakes!

var myCountry = 'USA'
console.log('myCountry '.length);
console.log('mycountry'.substring(0,3));

thank you for taking the time to look at this:blush:


#2

This line is correct, but missing a semi-colon at the end:

var myCountry = 'USA'

This line is incorrect since the variable is written between two quotes, making it a string primitive, not a reference.

console.log('myCountry '.length);

This line also has quotes, and it does not match the variable name. JS is case sensitive. "name" and "Name" are two different strings. myCountry and mycountry are two different variables.

console.log('mycountry'.substring(0,3));

#4

I'm Stuck on the same thing but this is what I did:
// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry= "England" ;

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

And it doesn't seem to work :frowning:


#5

Please read the above post about not using variables wrapped in quotes.