25. More Variable Practice :/ problem


#1

Its has an error = "Oops, try again. It looks like you didn't log the first 3 letters of myCountry to the console."

idk what im doing wrong?

here is my code :

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "South Africa";

// 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

Hi,

the issue is here console.log(myCountry.substring(0.3));

Change "." to "," and your code will run!

Here is your corrected code:

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry = "South Africa";

// 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));


#3

substring(0.3) // wrong // use , not .


#4

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