Stuck on 25. More Variable Practice


#1

Please help! I am stuck on 25. More Variable Practice.

I get the following error message:
"Oops, try again. It looks like you didn't log the first 3 letters of myCountry to the console."

Here is my code:

// Declare a variable on line 3 called
// myCountry and give it a string value.
var mycountry = "straya";

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

What am I doing wrong?


#2

// Use console.log to print out the first three letters of myCountry.
console.log(mycountry.substring(0,3)); <------- Change "mycountry" to "straya".


#3

Hello @kasha28,

you have to set the variable-names as it's demanded in the exercise.
So instead of mycountry try myCountry (uppercase 'C')
everywhere where you actually use the variable-name ...

Which means:

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "straya"; // Here,

// Use console.log to print out the length of the variable myCountry.
console.log(myCountry.length); // here,

// Use console.log to print out the first three letters of myCountry.
console.log(myCountry.substring(0,3)); // and here.

This should solve your problem :slight_smile:


#4

Thank you, I thought I had to add an === (number of length here) which i didn't. I solved it in the code :stuck_out_tongue:


#5

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