Amit Dhamu

Software Engineer

Generate Initials From String

const initials = string => (
    string.split(' ').map(s => (
        s.charAt(0)
    )).join('')
);
> initials('John Smith');
'JS'
> initials('John James Smith');
'JJS'
> initials('John James-Smith');
'JJ'
> initials('JohnJames-Smith');
'J'
> initials('james has lots of names');
'jhlon'

 initials / es6

Restore macOS DesktopList Available Makefile Commands

Show Comments

Made with by Amit Dhamu.
© MMXX. All rights reserved.