Question : Capitalize first letter of each word
Answered by : inquisitive-iguana-l7gzcwbw7ohk
const toTitleCase = str => str.replace(/(^\w|\s\w)(\S*)/g, (_,m1,m2) => m1.toUpperCase()+m2.toLowerCase())
console.log(toTitleCase("heLLo worLd"));
// Hello World
Source : https://stackoverflow.com/questions/32589197/how-can-i-capitalize-the-first-letter-of-each-word-in-a-string-using-javascript | Last Update : Thu, 26 May 22
Question : capitalize first letter of a string
Answered by : itchy-iguana-yewbikurcqns
const name = 'flavio'
const nameCapitalized = name.charAt(0).toUpperCase() + name.slice(1)
Source : https://www.tech-wiki.online/en/how-to-uppercase-first-letter-javascript.html | Last Update : Sun, 23 Jan 22
Question : Return the provided string with the first letter of each word capitalized
Answered by : jolly-jaguar-pptrptreleic
const mySentence = "freeCodeCamp is an awesome resource";
const words = mySentence.split(" ");
for (let i = 0; i < words.length; i++) { words[i] = words[i][0].toUpperCase() + words[i].substr(1);
}
words.join(" ");
Source : | Last Update : Sun, 24 Jul 22