javascript - Syntax Error: Unexpected Token -


rookie coder here!

i'm learning on codeacademy.org , keep getting error though i'm pretty sure been written correctly. help?

// declare variable on line 3 called // mycountry , give string value. var mycountry = "panama"; // use console.log print out length of variable mycountry. console.log(.length mycountry);  // use console.log print out first 3 letters of mycountry. console.log(mycountry .subscript(0,3)); 

there 2 problems example:

console.log(.length mycountry) 

isn't valid javascript; need

console.log(mycountry.length) 

(length property of variable mycountry).

also, subscript isn't js function, need substring.

full example:

// declare variable on line 3 called // mycountry , give string value. var mycountry = "panama"; // use console.log print out length of variable mycountry. console.log(mycountry.length);  // use console.log print out first 3 letters of mycountry. console.log(mycountry.substring(0, 3)); 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -