Skip to content

Instantly share code, notes, and snippets.

@Stefanacef
Last active September 25, 2021 09:01
Show Gist options
  • Save Stefanacef/738684780bbb89a22789a378cfdf76b5 to your computer and use it in GitHub Desktop.
Save Stefanacef/738684780bbb89a22789a378cfdf76b5 to your computer and use it in GitHub Desktop.
Capitalize Letters | Solution | JavaScript
//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