W3Cschool编程实战JS脚本算法挑战:
function findLongestWord(str) { var arr=str.split(' '); var arrlength=0; for(var i=0;i<arr.length;i++){ if(arr[i].length>arrlength){ arrlength=arr[i].length; } } return arrlength; } findLongestWord("The quick brown fox jumped over the lazy dog");