DEV Community

loading...

Discussion on: Daily Challenge #38 - Middle Name

Collapse
alvaromontoro profile image
Alvaro Montoro

I also did a JavaScript version on that same demo:

const middleName = name => name.split(' ')
                               .map((val, idx, arr) => idx == 0 || idx == arr.length - 1 
                                                        ? val 
                                                        : val[0] + ".")
                               .join(' ');