Skip to content

Instantly share code, notes, and snippets.

@gerlacdt
Last active March 18, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerlacdt/9775d6ab24da64df2fa1a57c40c3e1a0 to your computer and use it in GitHub Desktop.
Save gerlacdt/9775d6ab24da64df2fa1a57c40c3e1a0 to your computer and use it in GitHub Desktop.
function getNickname(fullname) {
return fullname
.split(/\s+/)
.map(n => n.substring(0,3))
.join('');
}
const result = getNickname('Daniel Gerlach');
console.log(result); // => DanGer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment