NOT A STRING var myCountry = "debopaloola"


#1


Please help I have tried several times with various adaptations but cannot seem to solve this one. It is stating myCountry is not a string but as you will see I used var = "myCountry"


https://www.codecademy.com/courses/getting-started-v2/4/2?curriculum_id=506324b3a7dffd00020bf661


Oops, try again. It looks like myCountry isn't a string.


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

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

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


#2

Update my console now shows the correct values

9 for the length and
3 for the substring count

but still failing as myCountry is not a string???

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

// 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((0,3));

#3

These two are not the same thing:

myCountry // a variable that is currently set to "debapaloola"
"myCountry"  // a string consisting of the letters "myCountry"

Do you see the problem now?


#4

yep I see it now thanks albionsrefuge... :slight_smile:


#5

2 posts were split to a new topic: Is it bad, that I can't see the problem?


#6

i totally knew that! haha

thanks for pointing that out for me!


#7

Was doing the exact same mistake as well.


#8

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