how to make first letter of string capital in js 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: capitalize in javascript
const name = 'flavio'
const nameCapitalized = name.charAt(0).toUpperCase() + name.slice(1)