How to convert a full name to an acronym with the initials

Posted on October 9, 2021

So, your name is John Doe and want to get JD in javascript?

const shortNames = n => {
  return n.split(' ').map(d => d.substr(0, 1).toUpperCase()).join('')
}

shortNames('John Doe') // JD