Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yep! Or even:

    const initials = name.match(/\b\w/g).join('')


JavaScript's \b in a regex doesn't like unicode.

But, yes, this does seem an odd thing to call out to a remote api for.

This would need some work to match the features of what was posted, but not much. https://jsfiddle.net/g6nrs5cq/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: