Created
June 15, 2014 19:15
-
-
Save macikokoro/ce4b7458091e7251c257 to your computer and use it in GitHub Desktop.
A cool way to use substrings to capitalize the first letter of a name.
This file contains hidden or 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
var fullName = ""; | |
var name; | |
var firstLetter; | |
var fixName = function () { | |
} | |
name = prompt("Enter your first name (all in lower case):"); | |
firstLetter = name.substring(0, 1); | |
name = firstLetter.toUpperCase() + name.substring(1); | |
fullName = fullName + " " + name; | |
name = prompt("Enter your second name (all in lower case):"); | |
firstLetter = name.substring(0, 1); | |
name = firstLetter.toUpperCase() + name.substring(1); | |
fullName = fullName + " " + name; | |
console.log("And your full name is:" + fullName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment