Advertisement
Guest User

Untitled

a guest
Oct 4th, 2016
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. function toTitleCase(str) {
  2. let convertToLower = str.replace(/\w+/g, lower)
  3. let result = convertToLower.replace(/\b\w/g, upper);
  4. console.log(result);
  5. function lower(str) {
  6. return str.toLowerCase();
  7. }
  8. function upper(str) {
  9. return str.toUpperCase();
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement