This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by harde6321
over 9 years

error message:you have not set variable to console log? please help what am i doing wrong

// Declare a variable on line 3 called // myCountry and give it a string value. var myCountry=(“United States”.substring(0,13)); console.log(“United States”.substring(0,13)); console.log(“Uni”.substring(0,3));

Answer 54289642282ae353aa002166

1 vote

Permalink

var myCountry=("United States".substring(0,13));

should be

var myCountry="United States";

AND

console.log("United States".substring(0,13));

should be

console.log(myCountry.length);

AND

console.log("Uni".substring(0,3));

should be

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

The main thing to remember is that once you have declared your variable you should never retype the string. Always use and manipulate the variable. It’s about making the computer do the work.

points
Submitted by Neil
over 9 years

1 comments

harde6321 over 9 years

Thank-you