Skip to main content

getLastName()

function getLastName(fullName: string): string;

Returns the last word of a person's name, or an empty string if the name is blank. A one-word name is its own last name.

Status text is left out as it is for getFirstName, so Ada Lovelace (OOO Friday) gives Lovelace. A trailing emoji still counts as a word here, so Ana Silva 🌴 gives 🌴, while getShortName skips it when picking the initial.

Parameters​

ParameterTypeDescription
fullNamestringThe person's full name, such as a user's name or fullName

Returns​

string

The last name, or an empty string for a blank name