Find the Longest Word in a String
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Find the Longest Word in a String相关的知识,希望对你有一定的参考价值。
这是一些对你有帮助的资源:
- String.length
function findLongestWord(str) { // 请把你的代码写在这里 str = str.split(" "); var result = 0; for(var i=0;i<str.length;i++){ if(str[i].length>=result){ result = str[i].length; } } return result; } findLongestWord("The quick brown fox jumped over the lazy dog");
以上是关于Find the Longest Word in a String的主要内容,如果未能解决你的问题,请参考以下文章
Find the Longest Word in a String
freeCodeCamp:Find the Longest Word in a String
[LeetCode 1371] Find the Longest Substring Containing Vowels in Even Counts
524. Longest Word in Dictionary through Deleting