LeetCode实现strStr() JavaScript解法

/** * @param {string} haystack * @param {string} needle * @return {number} */ var strStr = function(haystack, needle) { if(needle === "") return 0; let array =haystack.split(needle); if(array.length === 1) return -1; return array[0].length };

    推荐阅读