26 changing variable values


#1

so I have been working on this for like 30 mins. What am I doing wrong?

// On line 2, declare a variable myName and give it your name.
var myName = "GraceLamoreaux";
// 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 = myName.substring(0, 2));
// On line 9, use console.log to print out the myName variable.
console.log(myName);


#2

check your brackets, you're using one too many.


#3

Common programming mistakes
// On line 2, declare a variable myName and give it your name.
var myName = "GraceLamoreaux";
// 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 = myName.substring(0, 2)); <------------------remove the second bracket.
// On line 9, use console.log to print out the myName variable.
console.log(myName);


#4

// On line 2, declare a variable myName and give it your name.
var myName="Ryan";
// 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.
console.log(myName.substring(0, 2));
// On line 9, use console.log to print out the myName variable.
console.log("myName");
this is my code,It looks like you didn't log your whole name to the console.,someone can help me figure it out


#5

When you assigned the value "Ryan" to the variable myName that then gave you the ability to use myName. You did that correctly on line 7 but you didn't get it right when you wrote both of your console.logs.

"myName" means a string of these characters: myName
myName is a variable that is currently holding this string of characters: Ryan

Do you see the difference there?