On 25. More Variable Practice


#1

I wrote this following code but getting TypeError: console.log is not a function

please help

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

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

just like length, sub string should be inside the brackets (()) of console.log, since you want to log part of the string to the console.


#3

Instead of this line:

write this line:
console.log(myCountry.substring(0,3));


#4

thanx buddy, worked as charm


#5

thank you for pointing out error.:+1: