Skip to content

Instantly share code, notes, and snippets.

@lachlan-eagling
Created March 16, 2017 21:38
Show Gist options
  • Select an option

  • Save lachlan-eagling/a2f9d6dd000dab5442ff0b0af2ac1a2a to your computer and use it in GitHub Desktop.

Select an option

Save lachlan-eagling/a2f9d6dd000dab5442ff0b0af2ac1a2a to your computer and use it in GitHub Desktop.
function findLongestWord(str) {
var words = str.split(" ");
str = "";
for(var i = 0; i < words.length; i++){
if(words[i].length > str.length){
str = words[i];
}
}
return str.length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment