Code Golf · #42 · 2026-05-16
Find the longest word
Difficulty 3/3 · JavaScript
How to play
Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.
Given a string of space-separated words, return the longest word. If tied, return the first one.
Examples
f("the quick brown fox") → quick
f("programming is fun") → programming
Loading your progress...
Your code (function body — receives input)
function(input) { 0 chars
}
Write the shortest JavaScript function body that passes all tests · Back to hub