Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The
^
symbol means "at the start of the string"--meaning the original string. It doesn't know about the internal implementation of how your code is finding the index. So feel free to chop up the string if you wish, but bear in mind that the regex needs to properly match the original string.To demonstrate:
Hi there,
Would someone please explain to me this test?
"abcba".indexOf(/^c/, 2) - Expected: -1, instead got: 2.
Per my understanding this should be checking the "cba" substring if it matches the /^c/ pattern.
Since "cba" starts with "c" I don't understand, why should return not found (-1)
Thank you!