Question : JavaScript: Uppercase First Letter of Every Word

Using JavaScript, I want to make the first letter of every word uppercase.

Answer : JavaScript: Uppercase First Letter of Every Word

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function toProperCase(s)
{
  return s.toLowerCase().replace(/^(.)|\s(.)/g, 
          function($1) { return $1.toUpperCase(); });
}

------- usage

var s = "my goodness no caps at all";
s = toProperCase(s);
Random Solutions  
 
programming4us programming4us