Skip to main content

Code Golf · #36 · 2026-05-10

Reverse word order

Difficulty 2/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 words in reverse order.

Examples

f("hello world") world hello
f("foo bar baz") baz bar foo

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