26. Javascript Change variable values


#1

I'm really stuck on this
// On line 2, declare a variable myName and give it your name.
myName = "Aeryn";
// On line 4, use console.log to print out the myName variable.
console.log("Aeryn");
// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName = Aeryn.substring(0,2);
// On line 9, use console.log to print out the myName variable.
console.log("Aeryn")
and I don't know what I'm doing wrong please help :(no_mouth:


#2

console.log(myName);

Should get you on the right track :relaxed:


#3

I'm so stuck too, added the console.log(myName); bit and still not going through .-. help!


#4

try
var myName = "put in your name";
console.log(myName);
myName = "put in your name".substring(0,2);
console.log(myName);
try it and see how that works :wink: :relaxed:


#5

hm i see not to be getting it right still. totally stuck


#6

Could you please show me exactly what your code looks like please just so I know what you have put in


#7

i got it, didnt put the correct parentheses in lol


#8

That's good, sorry if I didn't help you


#9

A post was split to a new topic: Error take another look at the hint


#10

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


#11

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


#12

Make Chantel into a string

"Chantel"

Take the myName variable out of " " as you dont want to make that a string.


#13

the code woked thanks alot