In String Practice #23 I keep getting the error message "You have selected the wrong substring in January" although I have chosen the correct substring "//console.log "January" substring (0,2))


Replace this line with your code.


Hi Salli,

Please use the edit button to improve your question. The template will help you with that.


I have tried to edit the code referenced above many times but it will not work and I cannot skip over it and progress.




Don't worry about the code in the exercise just yet.

It will help people understand your question, if first, you edit your original question here in this forum.

Add a link to the exercise. Replace the line that says "Replace this line with your code" with the code that you have tried in the exercise.


If that is the code that you have used, then there is a problem because you have made it a comment by adding // at the beginning. That tells the JavaScript interpreter to ignore that line.


Thanks I got it to work. However I am a little confused by the "0" position. For the word "January" the J is in the zero spot but a=1 and n=2 but it seems like n must =3. Please explain.


You are correct that:
0 : J
1 : a
2 : n
3 : u

substring works like this:

.substring(starting character, up to but not including the end character)


So why does it not accept


Could you give me a screen shot showing that code not being accepted please?


Here it is. I have tried retyping the January line, and different start and end position numbers, all with the same result. Am I missing seeing a mistake in what I entered?

Thanks for following up.


I like solving problems :wink:

The problem there is that you've missed a bit of the instructions. They have asked you to print out the substrings but you haven't yet.


Sorry for disturbing you, but I have the same problem. I've printed substrings out, you can see it in interpreter, but i still can't go further because of "error"


Solved))) it was about lower case in "jan" instead of "Jan" ))


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