26.Change variable values



I was having trouble with this exercise as well. I tried what you recommended zystvan, but it didnt work. What finally worked was this:

line 2: var myName = "Parker";

line 4: console.log(myName);

line 7: var myName = "Pa";

line 9: console.log(myName.substring (0,2));

26.Change variable values.Sorry i need help again!

@parkerbeck_ Did console.log(myName); not work on line 9?


Hi Parker, I was able to do this problem successfully after looking a little at your post.

Compare your answers with mine. Sometimes Javascript is a little weird with how you position things so sometimes functions have to be touching and have no spaces between them. Hope this helps!

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