JavaScript实现-找出最长单词-Find the Longest Word in a String
来源:互联网 发布:成都餐饮网络建设电话 编辑:程序博客网 时间:2024/05/14 10:25
找出最长单词
在句子中找出最长的单词,并返回它的长度。
函数的返回值应该是一个数字。
参考String.split()和String.length
function findLongestWord(str) { // 请把你的代码写在这里 var arr = str.split(" ");var max = 0;for (var i = 0; i<arr.length; i++){if (arr[i].length >= max){max = arr[i].length;}}//console.log(max);return max;}findLongestWord("The quick brown fox jumped over the lazy dog");
阅读全文
0 0
- JavaScript实现-找出最长单词-Find the Longest Word in a String
- FCC算法:四、Find the Longest Word in a String -- 找出最长单词
- Bonfire: Find the Longest Word in a String 找出一句话中最大的单词
- Find the Longest Word in a String
- freecodecamp学习--Find the Longest Word in a String
- choose the longest word in the line .把字符串中最长的单词输出
- Find the longest substring with k unique distinct characters in a given string (Google)
- 《牛客网leetcode144题》Given a string S, find the longest palindromic substring in S
- find the longest numeric string in the given input strings
- Given a string, find the length of the longest substring without repeating characters
- 找出最长单词
- 438 Find All Anagrams in a String 找出字符串中所有的变位词
- Reverse Word in a String
- Write a function to find the longest common common string amongst an array of strings.
- Write a function to find the longest common prefix string amongst an array of strings.
- leetcode Longest Substring Without Repeating Characters Description: Given a string, find the leng
- 4、Write a function to find the longest common prefix string amongst an array of strings
- 438. Find All Anagrams in a String\389. Find the Difference
- Github桌面版使用方式(How to Use Github [Desktop Version])
- extjs:Cannot read property 'processed' of undefined
- QT中tableview基本用法
- get()与getline()
- 配置篇 06. 添加桌面图标 ❀ Windows Server 2016
- JavaScript实现-找出最长单词-Find the Longest Word in a String
- 昆石VOS3000_2.1.2.4安装脚本
- UMSocialPlatformErrorDomain Code=2001
- SYZOJ中文安装指南
- quartz和sping的集成和使用
- Unity的Gamma渲染管线和Linear管线的区别
- Nginx防盗链的3种方法
- CentOs7虚拟机与防火墙
- MFC+Opencv显示图像的几种方法