d
Amit DhamuSoftware Engineer
 

Capitalize Word

1 minute read 00000 views

Method 1

const capitalize = word =>
  word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()

Method 2

const capitalize = ([firstLetter, ...otherLetters]) =>
  firstLetter.toUpperCase() + otherLetters.join('').toLowerCase()