I\'m trying to proper case a string in javascript - so far I have this code: This doesn\'t seem to capitalize the first letter, and I\'m also stuck on how to lowercase all the l
My Solution
function titleCase(str) { var myArr = str.toLowerCase().split(" "); for (var a = 0; a < myArr.length; a++){ myArr[a] = myArr[a].charAt(0).toUpperCase() + myArr[a].substr(1); } return myArr.join(" "); }