Created
          December 5, 2015 13:16 
        
      - 
      
 - 
        
Save anonymous/e7d8f8b57abc7349cb75 to your computer and use it in GitHub Desktop.  
    http://www.freecodecamp.com/bskydive 's solution for Bonfire: Title Case a Sentence
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Bonfire: Title Case a Sentence | |
| // Author: @bskydive | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence# | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function titleCase(str) { | |
| var strToMasUpperCased=str.split(' ').map( | |
| function (val){ | |
| val=val.toLowerCase(); | |
| var valToMas=val.split(''); | |
| valToMas[0]=valToMas[0].toUpperCase(); | |
| return valToMas.join(''); | |
| } | |
| ).join(' '); | |
| return strToMasUpperCased; | |
| } | |
| titleCase("I'm a little tea pot"); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment