Created
September 30, 2018 01:18
-
-
Save jordanhudgens/e55d8c46ff164127d1cf29c27630fdf9 to your computer and use it in GitHub Desktop.
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
const toCapital = str => { | |
const words = str.split(" "); | |
return words.map(word => word[0].toUpperCase() + word.slice(1)).join(" "); | |
}; | |
const shortStr = "Hi there"; | |
toCapital(shortStr); // Hi There | |
const longStr = "the quick brown fox jumped over the lazy dog"; | |
toCapital(longStr); // The Quick Brown Fox Jumped Over The Lazy Dog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment