编辑代码

function titleCase(str){
    return str.toLowerCase().replace(/^\w|\s\w/g,w=>w.toUpperCase())
}
console.log(titleCase("I'm a little tea pot"));