pastebin

Paste Search Dynamic
capital_letter
  1. function capital_letter(str)
  2. {
  3.     str = str.split(" ");
  4.  
  5.     for (var i = 0, x = str.length; i < x; i++) {
  6.         str[i] = str[i][0].toUpperCase() + str[i].substr(1);
  7.     }
  8.  
  9.     return str.join(" ");
  10. }
  11.  
  12. console.log(capital_letter("Write a letter to the ghost."));
Parsed in 0.002 seconds