Please someone help with the correct code for step 26 I am stuck, thanks


#1


Replace this line with your code.


#2

please paste your code here so we can help you :slight_smile:


#3

Ok. This is my code:

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


#4

I am trying yet am getting errors. I will appreciate your help, please.....


#5

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

so i would write like this
console.log(myName);

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

i think you can do it :slight_smile:


#6

This is what I have done, but I am getting this error:
Oops, try again.
Your code doesn't look quite right. Check the Hint if you need help!

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

Kindly send me the correct codes, Will appreciate thanks.


#7

I am trying to follow other peoples comments but am not getting it.


#8

substring:

myName.substring(0,2);


#9

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

Whats the problem with that, am not yet there. Am getting the same problem:oops...


#10

can you please give me the link


#11

This is the link:


#12

#13

Have you got the link.


#14

what are you doing?
give me the course link .

where are you writing your code?


#15

ok leave it.i m telling you whats your problem.
// On line 7, change the value of myName to be just the first 2
// letters of your name.
myName.substring(0,2);

you have to assign this value to myName variable .

myName= myName.substring(0,2);


#16

#17

Thenkyou so much Mr.... Codeman? It has worked at last. I have been getting problems since Friday. I appreciate your assistance very much. Have a good day.


#18

most welcome :slight_smile:
and you can check these to know more about substring

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/substring

http://www.w3schools.com/jsref/jsref_substring.asp

and to know How to use the Codecademy Community Forums check it


#21