Skip to content

The solution of the problem from Codewars "Stop gninnipS My sdroW!"

Notifications You must be signed in to change notification settings

den-mesh/Stop-gninnipS-My-sdroW-__JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Stop-gninnipS-My-sdroW-__JavaScript

======= The solution of the problem from Codewars "Stop gninnipS My sdroW!" =======

Conditions of the problem

Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present.

Examples: spinWords( "Hey fellow warriors" ) => returns "Hey wollef sroirraw" spinWords( "This is a test") => returns "This is a test" spinWords( "This is another test" )=> returns "This is rehtona test"

======= The solution of the problem =======

function spinWords(words) {

return words.split(' ') .map(word => word.length < 5 ? word : word.split('').reverse().join('')) .join(' '); }

About

The solution of the problem from Codewars "Stop gninnipS My sdroW!"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published