Find the Index of the First Occurrence in a String

LeetCode題目: 28. Find the Index of the First Occurrence in a String

My solution:

/**
 * @param {string} haystack
 * @param {string} needle
 * @return {number}
 */
let strStr = (haystack, needle) => haystack.indexOf(needle);
profile-image
Hi, 我是 Zeki。目前為一名前端工程師。我相信科技始終來自於人性,是用來幫助人們過上更有品質的生活的,但願也希望如此。