Help with change variables value #26


#1

Help with change variables value #26

please help i don't know// On line 2,

declare a variable myName and give it your name.
var myName = abdoul
// 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.

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

what to do


#2

Do you think you could add your code and explain where specifically you got code? Include the error you're receiving also if possible.


#3

Well remember, "myName" is a string, that means you have to wrap the value in quotation marks.

var myName = "abdoul";

Remember also, that console.log statements are in the parenthesis:

console.log(myName); //myName is a variable, not a string, no quotation marks needed!

In the lessons previous to this it showed how to take the first couple letters out of your name with the ".substring" method.

myName = myName.substring(0,2);

Then it wants you to console.log your name again (use the same variable as above).

You're close, just a little bit off the mark. I hope this helps! :+1:


#4

thx man..................


#5

Does that help? or would you like me to explain it a little more in depth? I can do that for you if you'd like.


#6

no thx i get it ,im on #27 now conclution part 1


#7

Try taking the quotation marks off of "myColor" in the console.log statement. It's a variable, so if you put quotation marks around the variable it actually makes it a string (or a word) instead of using the word stored inside of the variable myColor which is equal to "gray".


#8

i did not work..................


#9

Could you post your new code for me to see?