Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a function to reverse the words in a sentence while preserving their order.

Medium

Problem Statement

Create a function to reverse the words in a sentence while preserving their order.

Sample Input

"Hello World"

Sample Output

olleH dlroW

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Reverse each word in a sentence function reverseWords(sentence) { } console.log(reverseWords("Hello World"));
Log in or sign up to run or submit your code.Log inSign up
Input
"Hello World"
Expected Output
olleH dlroW