-1

How to Convert first word of a sentence to UPPERCASE LETTERS in javascript/angularjs ?

user8114280
  • 7
  • 1
  • 5

2 Answers2

0

let firstUpper = "some text to work".split(' ')[0].toUpperCase();

Abdul
  • 577
  • 1
  • 5
  • 21
0

Basic solution:

function capitalizeFirstLetter(string) {
 return string.charAt(0).toUpperCase() + string.slice(1);
 }

   console.log(capitalizeFirstLetter('foo')); // Foo ´´´
GIbrain
  • 1
  • 1