[Longest Word] Script for find the longest word in a sentence #vanilla #script
function findLongestWord(str) {
var bigone=0;
var word=str.split(" ");
for(var i=0;i<word.length;i++){
if(word[i].length>bigone){
bigone=word[i].length;
}
}
return bigone;
}
//findLongestWord("The quick brown fox jumped over the lazy dog");