To use it, very simple, include this javascript anywhere you want (but before calling it), then:
"Tommy Lee Jones".getInitials();
It will return TLJ
.
If you prefer to get an array of initials, call "Tommy Lee Jones".getInitials(false);
, then it will return an array.
Currently, due to JS regex limitations, it doesn't support well special chars. So it removes special chars to avoid wrong initials.