Last active
April 30, 2019 19:41
-
-
Save tamunoibi/e5141885295eff82ead9b700635c9a43 to your computer and use it in GitHub Desktop.
Andela challanges
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 longest(sentence) { | |
var str = sentence.split(" "); | |
var longest = 0; | |
var word = null; | |
str.forEach(function(str) { | |
if (longest < str.length) { | |
longest = str.length; | |
word = str; | |
} | |
}); | |
return word; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment