@wuxh/utils
    Preparing search index...

    Function findBestMatch

    • 查找字符串数组中最长连续匹配项目

      Parameters

      • strArr: string[]
      • OptionaltargetStr: string

      Returns undefined | string

      ChatGPT

      const words = ['apple', 'banana', 'orange', 'pear'];
      const searchWord = 'ange';
      const bestMatch = findBestMatch(words, searchWord);

      console.log(bestMatch); // Output: "orange"