栈 - 找出字符串中第一个匹配项的下标
javascript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function strStr(haystack, needle) {
return haystack.indexOf(needle);
}
;
console.log(strStr('hello', 'll'));typescript
function strStr(haystack: string, needle: string): number {
return haystack.indexOf(needle)
};
console.log(strStr('hello', 'll'))