Created
April 6, 2017 04:34
-
-
Save anonymous/5219d0416b3dabd5a59880b45c3349a2 to your computer and use it in GitHub Desktop.
2.3 Nickname Generator created by smillaraaq - https://repl.it/GvJF/3
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 nicknameGenerator(fullName){ | |
var nickName=""; | |
var fullNameTemp=fullName.toLowerCase(); | |
if(fullNameTemp[2]==="a" || | |
fullNameTemp[2]==="e" || | |
fullNameTemp[2]==="i" || | |
fullNameTemp[2]==="o" || | |
fullNameTemp[2]==="u"){ | |
//log 4 letters | |
nickName=fullName.slice(0,4); | |
}else{ | |
//log 3 letters | |
nickName=fullName.slice(0,3); | |
} | |
console.log("The nickname for " +fullName+ " is '" + nickName + "'."); | |
return nickName; | |
} | |
nicknameGenerator("ALICE"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment