Created
November 22, 2015 22:57
-
-
Save dmidlo/ed2a21c96913046de1ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findLongestWord(str) { | |
var charCount = 0; | |
var strArray = str.split(' '); | |
for(var i = 0;i < strArray.length ;i++) | |
{ | |
if(strArray[i].length > charCount) | |
{ | |
charCount = strArray[i].length; | |
} | |
} | |
return(charCount); | |
} | |
findLongestWord("The quick brown fox jumped over the lazy dog"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment