how to make a text first letter capital in javascript code example
Example 1: javascript uppercase first character of each word
const uppercaseWords = str => str.replace(/^(.)|\s+(.)/g, c => c.toUpperCase());
// Example
uppercaseWords('hello world'); // 'Hello World'
Example 2: first letter tuUppercase
const string = "tHIS STRING'S CAPITALISATION WILL BE FIXED."
const string = string[0].toUpperCase() + string.slice(1)