25. "USA".substring(0,3)


#1

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "USA";
"USA".substring(0,3)
// Use console.log to print out the length of the variable myCountry.

console.log("USA".length );

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


25. I was defining the variable on the line after "console.log"
#2

Hi if you want to put the first 3 letter you should put this USA".substring(0,3) inside the console.log()


#3

3 posts were split to a new topic: 25. I can't seem to get the code right


#4

Good job getting it. Is it better to use the variable name or does it not matter? This way of using the string is efficient but it's better to simply use the myCountry var and not use the " " around them in the console.log(myCountry.length);

This generates the same result. Wondering people's thoughts.