Please help Im stuck on 25


#1



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


// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry="United States"

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


#2

You have saved your string inside variable called myCountry.
If you wanna console.log out the length of the string, then you can call .length on your variable where string is saved and not directly on a string.

Example:
console.log(myCountry.length); -> without the " ".

I hope I made it a bit more clear now :slight_smile:


#3

You are amazing lol. Thanks


#4

I'm stuck on the same thin but i can't seem to get it


#5

Same goes for you as I said above.
You are trying do .substring() on a string and you need to do it on a variable that holds the string.

Example:

var myCountry = "red"; //you have here a variable called myCountry and it holds a string

console.log("myCountry".substring(0,9)); //here is the problem with "myCountry" instead of myCountry

// " " -> this means that anything inside it is a string and you don't need that.
// you need variable that holds a string and that one is myCountry without the " "

#6

but when i take the " " out it say that myCountry isn't a string


#7

var myCountry = "red";

console.log(myCountry.substring(0,9)); // I was talking about myCountry here, instead of "myCountry"

console.log(myCountry.substring(0,3)); /* above example goes for this one too */

#8

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "West"
// 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));

I fixed it with the above corrections...it's telling me "TypeError: console.log is not a function". Where am I going wrong?


#9

It should work. Try restarting the exercise and write it again.


#10

Hey Vijay , as dayfiri said refresh your exercise and it should work. The code you have written is 100% right ! Good Job man.:slight_smile:


#11

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