https://www.codewars.com/kata/5259b20d6021e9e14c0010d4
Codewars - Achieve mastery through coding practice and developer mentorship
A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!
www.codewars.com
DESCRIPTION:
Complete the function that accepts a string parameter, and reverses each word in the string. All spaces in the string should be retained.
Examples
"This is an example!" ==> "sihT si na !elpmaxe"
"double spaces" ==> "elbuod secaps"
코드
function reverseWords(str) {
return str.split(" ").map(el =>el.split("").reverse().join("")).join(" ");
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Reversed sequence (8 kyu) / JavaScript (0) | 2023.01.20 |
---|---|
[Codewars] Fake Binary (8 kyu) / JavaScript (0) | 2023.01.19 |
[Codewars] Beginner Series #1 School Paperwork (8 kyu) / JavaScript (0) | 2023.01.17 |
[Codewars] Invert values (8 kyu) / JavaScript (0) | 2023.01.16 |
[Codewars] Human Readable Time (5 kyu) / JavaScript (0) | 2023.01.15 |
댓글