Getting started with programming (More Variable Practice#25)


#1

// Declare a variable on line 3 called
// myCountry and give it a string value.
var myCountry="United States";
"myCountry"'substring'.length(0,8);
// Use console.log to print out the length of the variable myCountry.
console.log.("myCountry")'substring'.length(0,9));
// Use console.log to print out the first three letters of myCountry.
console.log.("myCountry")'substring'.length(0,4));

//My coding syntax is incorrect. ????
Anitra


#2

Notice there are no quotes on myCountry, but are instead on the string it represents? Anywhere we write this variable, we are representing the string, "United States".

console.log(myCounty.length);    // 13

#3

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