More variable practice


#1

<

what is wrong with my code?
// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "LA";
myCountry.substring(0,9);

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


"myCountry".console.log (0,9);

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

#2

There are few mistakes there.
In JavaScript console.log(); is written this way and the value you want to log out, you put it inside the ().

  1. So, for consoling out the variable myCountry length you would do:

console.log(myCountry.length);

And the same rule would follow for the substring.

console.log(myCountry.substring(0,3));

If you feel like something haven't completely sit in your mind with code or how's it written, you can always go back in exercises and remind yourself :wink:


#3

Wow thanks that helps.


#4

So I

for my console.log's THX @dayfiri


#5

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