← Back to challenges

Modify Words

JavaScriptHardarraysformattingloopssortingstrings

Instructions

Create a function that takes an array of any length. Modify each element (capitalize, reverse, hyphenate).

Examples

editWords(["new york city"]) ➞ ["YTIC KR-OY WEN"]

editWords(["null", "undefined"]) ➞ ["LL-UN", "DENIF-EDNU"]

editWords(["hello", "", "world"]) ➞ ["OLL-EH", "-", "DLR-OW"]

editWords([""]) ➞ ["-"]

Notes

Input array values can be any type.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.