Substrings Programming - Basic I am stuk


#1

Find the 4th up to and including the 7th letter of the string "wonderful day".

// Be careful with the substring's letter positions!
"wondrfulday".substring(4,7);

I am getting this error

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


#2

Look at this:

"wondrfulday"  "wonderful day"

READ THE ERROR MESSAGE.


#3

The substring method extracts the characters in a string between "start" and "end", not including "end" itself. Meaning that in order to include the 7th letter you would need to end the substring with 8.

"wondrfulday".substring(4,8); // "rful"

If, as @cadecodes and the error message suggests the code should be:

"wonderful day".substring(4,8); // "erfu"