Skip to content

Instantly share code, notes, and snippets.

@guumaster
Created November 2, 2015 16:27
Show Gist options
  • Save guumaster/f635b7fc4fe1ce289d7f to your computer and use it in GitHub Desktop.
Save guumaster/f635b7fc4fe1ce289d7f to your computer and use it in GitHub Desktop.

Exercise 1

create modules to implement this features

  • convert string to title capitalized
  • sanitize a string
  • count word frequency
@IGZdiegoherrera
Copy link

function capitalize(str) {

    let aux;
    let arr = [];

    str.split(/ +/).map(function(word) {
        aux = word.substring(0, 1).toUpperCase() + word.substring(1, word.length).toLowerCase();
        arr.push(aux);
    });

    return arr.join(" ");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment