Need help with a problem


// Declare a variable on line 3 called
// myCountry and give it a string value.

// Use console.log to print out the length of the variable myCountry.
console.log(var myCountry ==== "United States" );
// Use console.log to print out the first three letters of myCountry.
console.log(United States.substring(0,3));


The above should be your line 3 code. Be sure to use only a single = when making an assignment.

Use console.log() to log the variable...


This does not indicate string length.


Now log it.

The above will raise an exception. United is undefined (as is States). To JavaScript they look like identifiers (variable names). Use the variable, myCountry instead.


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