Solution for "string starts with capital letter in javascript"

function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } console.log(capitalizeFirstLetter('foo bar bag')); // Foo

capitalize first letter javascript

const uppercaseWords = str => str.replace(/^(.)|\s+(.)/g, c => c.toUpperCase()); // Example uppercaseWords('hello world'); // 'Hello World'

javascript uppercase first character of each word

Similar codes for "string starts with capital letter in javascript"


Latest 'Javascript' questions

Added before "string starts with capital letter in javascript"