DEV Community

loading...

Discussion on: Daily Challenge #38 - Middle Name

Collapse
hanachin profile image
Seiei Miyagi

ruby <3

def initialize_middle_name(n)
  n.split.then { |f, *mid, l| [f, *mid.map { @1.upcase[0] + ?. }, *l].join ' ' }
end