Lesson 25


#1

Im not sure if the result is right could someone verify please! as the result in console log are as follows:

7
eng

I thought it was supposed to count "mycountry" string and "myc" as first three letters

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

   
 var myCountry = "England";
    
    console.log(myCountry.length);
    
    console.log(myCountry.substring(0,3));

This returns 7 and "Eng"

{ } <--- not necessary