Need help

Can’t figure out how to get this too work. JavaScript number 25. More variable practice.


// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = “Northern Ireland”;

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

Keep getting an error message saying…Oops, try again. It looks like you didn’t log the length of myCountry to the console.


console.log("myCountry".length );

you log length of “myCountry” string to console, you should log the length of the string in myCountry variable

1 Like

I am not grasping what you meant at all sorry. could you write right the code out.


var myCountry = "Northern Ireland";

myCountry is a variable, "Northern Ireland" is a string

so if we want to log a variable to console, we shouldn’t use quotation mark, if you do (like you did), you will just log the string myCountry to console

if you log the variable to console, it should output Northern Ireland

1 Like

Hey, thanks a lot, it just couldn’t see what I was doing wrong at all.