Created
December 30, 2015 14:22
-
-
Save asvny/c389f19352849b5ddd60 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
var t = 'The quick brown fox jumped over the lazy dog' ; | |
const longestWord = (input) => { | |
let arr = input.split(' '); | |
let arrL = arr.map((word)=>word.length); | |
let max=arrL.reduce((prev,curr,i)=> curr > prev ? i : prev,0); | |
return arr[max]; | |
} | |
longestWord(t); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment