Lesson 25 Error you didn't log the length of my country


#1

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

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

// Use console.log to print out the first three letters of myCountry.

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


Replace this line with your code.


#2

The instruction for the 1st =console.log()=
Use console.log to print out the length of the variable myCountry

If you create a =string= in Javascript
you can automatically access the length of this =string=
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length

You also have several methods with which you can manipulating the =string=
look at the left-hand-column in the documentation


#3

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