Hacker News new | ask | show | jobs
by somewhereoutth 917 days ago
But "asdf".indexOf("sd") is 1, so indexOf("") finds the index of the first matching subsequence "", thus 0.

In reverse, the function would be 'return the subsequence starting at index, for some length', which for "" and 0 would indeed be "" for length = 0.

Array indexing [] is unrelated