2 ms·
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 subse
by somewhereoutth 3y 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