Changing variables


#1

Can someone help please?

// On line 2, declare a variable myName and give it your name.
var myName = "Lee";
// On line 4, use console.log to print out the myName variable.
console.log("Lee".length);
// On line 7, change the value of myName to be just the first 2
// letters of your name.
console.log("Lee".substring(0,2));
// On line 9, use console.log to print out the myName variable.
console.log("Lee".length);


#2

Use myName instead of "Lee". Also ".length" gives you the count of letters in string, not the variable.


#3

Thank you for your reply, sorry but I still don't understand? ;( Could you please write what the codes should be?

Thanks


#4

from "Lee" become just "Le" // On line 7, change the value of myName to be just the first 2
// letters of your name.

You don't need length & substring, just write your name

// On line 2, declare a variable myName and give it your name.
var myName = "Lee";

// On line 4, use console.log to print out the myName variable.
console.log(myName);

// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName = "Le";

// On line 9, use console.log to print out the myName variable.
console.log(myName);