Last active
September 25, 2021 09:01
-
-
Save Stefanacef/738684780bbb89a22789a378cfdf76b5 to your computer and use it in GitHub Desktop.
Capitalize Letters | Solution | JavaScript
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
//Capitalize Letters | |
const word = "i love you"; | |
const firstL = function (word) { | |
const w = word | |
.toLowerCase() | |
.split(" ") | |
.map((word) => { | |
// return word.slice(0,1).toUpperCase()+word.slice(1) | |
return word[0].toUpperCase() + word.substr(1); | |
}); | |
return w.join(" "); | |
}; | |
console.log(firstL(word)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment