📌  相关文章
📜  JS 最长单词 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.138000             🧑  作者: Mango

代码示例3
const wordsArray = ['1', '22', '222', 'longstring', '2222']
const longestWord = wordsArray.reduce((longestWord, currentWord) =>
    currentWord.length > longestWord.length ? currentWord: longestWord, '');
console.debug(longestWord); // longstring