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);