Changing Variable Values 26/28 Not Working


#1

Getting Started With Programming, Changing Variable Values

My Error Message

Oops, try again. It looks like you didn't log your whole name to the console.


Replace this line with your code. 

// On line 2, declare a variable myName and give it your name.
var myName="Smail";
// 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);


Whats Wrong With This?


#2

remove the equal sign between console.log and (myName).


#3

To change your myName it must be written exactly as it was when being created, instead of myname.

And then again,

Remove the equal sign here.


#4

Sorry I was in a rush to finish the lesson i messed up alot, thanks! =)


#5

I did it but its still not working

// On line 2, declare a variable myName and give it your name.
var myName="Smail";
// 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);


#6

Remember how they did it in the exercise before?

console.log(myCountry.substring(0, 2));

So I would say you don't need this line if you divide myName one line like the example above,

In fact 0, 2 are the values you need to get the first to letters of "Smail". :grin:


#7

Your code is correct. You didnt need something to change.

Please refresh your side, clear cache and try again.


#8

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