Skip to content

Instantly share code, notes, and snippets.

@jhsuZerion
Created January 7, 2018 03:01
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 jhsuZerion/9eb9e26f30e8919830dc919f26ee3b0c to your computer and use it in GitHub Desktop.
Save jhsuZerion/9eb9e26f30e8919830dc919f26ee3b0c to your computer and use it in GitHub Desktop.
/**
* Build full name based on three string values, will not double space
* @param {string} f first name
* @param {string} m middle name
* @param {string} l last name
* @return {string} three strings joined by space
*/
function makePersonFullName(f,m,l) {
var full_name = [];
if(typeof f === "string" && f.trim().length > 0) { full_name.push(f); }
if(typeof m === "string" && m.trim().length > 0) { full_name.push(m); }
if(typeof l === "string" && l.trim().length > 0) { full_name.push(l); }
return full_name.join(" ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment