Advertisement
tourniquet

Capitalize first letter of every wordconst titleCase = str =

Jun 29th, 2017
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const titleCase = str => str.toLowerCase().split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')
  2. titleCase("I'm a little tea pot") // I'm A Little Tea Pot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement