It’s telling me to declare a variable on line 3 called myCountry as you can see i id it.The second one is is telling me use the console.log to print out the length of the variable i did that as well.And the third one is telling me to print out the first three letters of myCountry i did that and it’s telling me Oops, try again. It looks like ‘myCountry’ on line 3 was not defined before it was used. This means either you need to define it, ‘myCountry’ is spelled incorrectly or you need quotes around ‘myCountry’.
console.log(“myCountry”)
var myCountry = “New York”;
// 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));
That should fix it if you still need help you do need line three and it needed quotations. Also the was a period(.) at the very end.
console.log(“myCountry”)
var myCountry = “New York”;
// Use console.log to print out the length of the variable myCountry.
console.log(“New York”.length);
// Use console.log to print out the first three letters of myCountry.
console.log(“New York”.substring(0,3));
i had it wrong the first time this works…
I’m also having little trouble here.
yes it works this way if you type console.log(“New York”.length); but as i understand the point is to use var myCountry to run it, instead of type out the name yourself.
so i understand the point is to do it so… console.log(“myCountry”.length); instead of… console.log(“New York”.length);
but its not working like this…
if i type out New York then whats the point of variable at all??
i hope someone can explain little.
Thanks a lot up front and i wish all happy coding day
In the future you should probably make your own topic. This is a Q&A forum so there’s no shame in doing so and I am sure many others here would appreciate that. I’ve seen them scold o.o