Skip to content

Instantly share code, notes, and snippets.

@tamunoibi
Last active April 30, 2019 19:41
Show Gist options
  • Save tamunoibi/e5141885295eff82ead9b700635c9a43 to your computer and use it in GitHub Desktop.
Save tamunoibi/e5141885295eff82ead9b700635c9a43 to your computer and use it in GitHub Desktop.
Andela challanges
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