How to Convert first word of a sentence to UPPERCASE LETTERS in javascript/angularjs ?
CodePudding user response:
let firstUpper = "some text to work".split(' ')[0].toUpperCase();
CodePudding user response:
Basic solution:
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() string.slice(1);
}
console.log(capitalizeFirstLetter('foo')); // Foo ´´´