[Vuejs]-Capitalize first letter in each word

5👍

Update –

If you still need a method to do that, try this regex pattern

function capitalize(value){
      return value.replace(/(?:^|\s|-)\S/g, x => x.toUpperCase());
}
 
 console.log(capitalize('hello i misunderstood your requirement initially by skipping the whole description'))

Leave a comment