loading...

re: Daily Challenge #263 - Reverse Words VIEW POST

FULL DISCUSSION
 

For Ruby

def reverse_words(str)
  str.split.map { |word| word.reverse }.join(" ")
end
 

Or more simply:

def reverse_words(str)
  str.split.map(&:reverse).join(" ")
end
 
code of conduct - report abuse