Stuck on lesson 25


#1


Hey all Im stuck on lesson 25 declare a variable and give it a string value. I put


var varName=myCountry 
console.log("myCountry").substring(0,8);


#2

A name would be string type data, so needs to be in quotes. The instructions ask for a variable,

var myCountry;

Now we can give it a value,

myCountry = "Canada";  // note the quotes on the **value**, not the variable

So now we can remove the quotes from your second line. You'll also notice a small correction:

// Use console.log to print out the first three letters of myCountry
console.log(myCountry.substring(0,3));

Be sure to follow the instructions closely. There is a middle instruction that you haven't coded:

// Use console.log to print out the length of the variable myCountry

#3

Thank you so much for your help! I am in school and its almost finals time. :disappointed_relieved: I can't wait to focus solely on learning to code.


#4

var myCountry;
myCountry= "America"
console.log(myCountry.substring(0,3));
console.log ("myCountry".length);// Declare a variable on line 3 called
// myCountry and give it a string value.
var varName=myCountry
"myCountry".substring(0,9));
console.log("myCountry");

// Use console.log to print out the length of the variable myCountry.
console.log( );

// Use console.log to print out the first three letters of myCountry.
console.log( );

Okay I screwed up somewhere ?


#5

var myCountry;
myCountry= "America";

console.log(myCountry.length);   // note no quotes on variable

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

#6

O meu estava dando erro , mais estava correto so faltou '()'.

// Declare uma variável na linha 3 chamada
// myCountry e atribua a ela uma string.
var myCountry = "Olá";

// Use console.log para exibir o comprimento da variável myCountry.
console.log("olá".length);

// Use console.log para exibir as tres primeiras letras de myCountry.
console.log(myCountry.substring(0, 3));


#7

Now that myCountry is loaded with a value, use the variable.

console.log(myCountry.length);