JSFiddle - React, Tailwind, and code Playground
JavaScript
const titleCase = str =>
str.split(' ').map(word =>
word.charAt(0).toUpperCase() + word.slice(1)
).join(' ');
alert(titleCase("I'm a little tea pot"));
const titleCase = str =>
str.split(' ').map(word =>
word.charAt(0).toUpperCase() + word.slice(1)
).join(' ');
alert(titleCase("I'm a little tea pot"));