Comment Comment by cyrusmg What's the logic behind returning anything but -1 (not found) ?Given "asdf".indexOf("a") is 0Then "asdf"[0] is "a"--Given "".indexOf("") is 0Then ""[0] is "" (which it's not in any language I know of) parent cyrusmg 2 years ago
Given "asdf".indexOf("a") is 0
Then "asdf"[0] is "a"
--
Given "".indexOf("") is 0
Then ""[0] is "" (which it's not in any language I know of)