Created
June 1, 2013 21:59
-
-
Save A-J-C/5691843 to your computer and use it in GitHub Desktop.
A CodePen by Alex C.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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