Created
March 16, 2017 21:38
-
-
Save lachlan-eagling/a2f9d6dd000dab5442ff0b0af2ac1a2a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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