Skip to content

Instantly share code, notes, and snippets.

@iainwatt
Created February 24, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iainwatt/cfc7a41204add4c83fa2 to your computer and use it in GitHub Desktop.
Save iainwatt/cfc7a41204add4c83fa2 to your computer and use it in GitHub Desktop.
CodeByte Longest Word (JavaScript)
function LongestWord(sen) {
var lng = sen.split(" ")
var longest = lng.reduce(function (a, b) { return a.length > b.length ? a : b; });
return longest;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment