I am trying to capitalize the first letter of only the first word in a sentence.
This is the data in the tsx file { this.text({ id: downloadPriceHistory
Why not just lowercase the entire string, and the uppercase just the first letter of the new string?
function titleCase(string) {
let sentence = string.toLowerCase();
let titleCaseSentence = sentence.charAt(0).toUpperCase() + sentence.substring(1, sentence.length);
return titleCaseSentence;
}
(Also, you're erasing your parameter to the function with that first line)
string = 'hello World';