How do you add a string value to a variable?


#1

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

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

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

im on 25 and this is the code. im not sure what to do with: var myName = "myCountry"
i have looked up many things, checked my code and searched online.nothing came up.
im stuck and i need to learn in detail on how to give a variable "string value".


#2

In direct answer to the question,

   new_value = "string value" + variable;

#8

You are declaring the variable myName instead of myCountry.

var myCountry = "yourcountry"


#9

Thanks, however, the feedback I get is that I am not declaring length.
So, the problem is that it will not accept my statement regarding length.

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

console.log ("myCountry.".length)

This is the way we dealt with length previously, but now it won't accept that format.I don't know why.


#10

We can store a string value in a variable.

var my_var = "some string value";

It's not the name of the variable we are focused upon, but the value it refers to.

console.log(my_var.length);

Notice there are no quotes. They are only ever used to delimit an actual string primitive.

"string primitive in quote marks"