Skip to content

Instantly share code, notes, and snippets.

@A-J-C
Created June 1, 2013 21:59
Show Gist options
  • Save A-J-C/5691843 to your computer and use it in GitHub Desktop.
Save A-J-C/5691843 to your computer and use it in GitHub Desktop.
A CodePen by Alex C.
function splitFLI(name) {
var names = name.split(" ");
var fullNameLength = names.join("").length;
var initials = "";
var i;
for (i = 0; i <= names.length - 1; i++) {
initials += names[i][0].toUpperCase();
}
console.log("Your first name is " + names[0] + " and your surname is " + names[names.length - 1] + ". Your initials are " + initials + ".");
return fullNameLength;
}
splitFLI(prompt("What is your full name?"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment