Stuck in JavaScript lection 22


I dont know how to come through the lection 22.
Can someone help me with lection 22???

What is deet substrings in 22, i am gona find the 4th and 7th letter through
"wonderful day".substring(x, y)


Hello @ajaxsurfer63507,

Please let's see what you've tried out. :slight_smile:


I have tried to write "wonderful day".substring(4,7);
and that is wrong.


Okay, you start counting from 0 for the first position/index, so you should have:

"wonderful day".substring(3,7);


If i write exactly that, this is coming.
Oops, try again. Did you remember to take your .substring() from the string 'wonderful day'? Make sure to type your string exactly as shown!

And this is what they want me to do.
Find the 4th up to and including the 7th letter of the string "wonderful day".


Please, show me your code after doing what I recommended.

Thank you.


@bayoishola20 This also helped for me thanks! But if you count from zero should the last number not be six and not seven? :slight_smile:


I also had this problem and I just reset the code after that just but back "wonderful day".substring(3,7); and you're good to go :wink:


See illustration:

| W | O | N | D | E | R | F  | U | L|
  0   1   2   3   4   5   6    7  8


Your end value is one step above the intended stop; whereas, start is exactly at start spot.

I hope this explains it. :slight_smile:


OMG, thank you mate, i just paste it, and i was done! :smile:


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