Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript capitalize all words

export function capitalize(str: string, all: boolean = false) {
  if (all)
    return str.split(' ').map(s => capitalize(s)).join(' ');
  return str.charAt(0).toUpperCase() + str.slice(1);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #capitalize #words
ADD COMMENT
Topic
Name
7+6 =