Changing variable values


#1

"Declare a variable Myname and give name"
myname="jack";

"print the myname variable"
console.log(myname);

"change the value of myname to be just first 2 letters of your name"
myname="mack";

print the myname variable"
console.log(myname);

Error:didn't log the first two letter of your name o the console

the above code will not work please help
error comes in thirdline


#2

To figure out what you need to change you'll need to start by identifying what it is doing differently from what you want it to be doing.
Right now it's unclear what you want to change, can't tell what you want help with!


#3

You've changed a letter in your name. The instructions say "//On line 7, change the value of myName to be just the first 2 letters of your name." so it should be "ja". Now, remember substring? You need to set myName to myName.substring(0, 2). So the answer is myName = myName.substring(0, 2)


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.