Is there a simple way to convert a string to title case? E.g. john smith becomes John Smith. I\'m not looking for something complicated like John R
john smith
John Smith
ES 6
str.split(' ') .map(s => s.slice(0, 1).toUpperCase() + s.slice(1).toLowerCase()) .join(' ')
else
str.split(' ').map(function (s) { return s.slice(0, 1).toUpperCase() + s.slice(1).toLowerCase(); }).join(' ')