javascript make change case code example
Example 1: javascript lowercase string
var str = "My Big Boy!"
var res = str.toLowerCase(); //res is "my big boy!"
Example 2: string to title case javascript
function titleCase(sentence) {
let sentence = string.toLowerCase().split(" ");
for (let i = 0; i < sentence.length; i++) {
sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);
}
return sentence.join(" ");
}