Algo-rithm problem
https://github.com/bmch/CapitalizeWordsInString.git
Fork this repo and then git clone
your forked repo to your computer.
Once you're happy with your solution, git push
and submit a pull request at
https://github.com/bmch/CapitalizeWordsInString.git
.
Your task is to add a prototype method to Javascript's string object. This method should capitalize the first letter of each word in a string. Good Luck!๐
const str = "A sentence is the largest independent unit of grammar: it begins with a capital letter and ends with a period";
str.capitalizeWords().should.equal('A Sentence Is The Largest Independent Unit Of Grammar: It Begins With A Capital Letter And Ends With A Period');
Refer to Test for More Examples
To test your solution, run npm i
in the root directory
and then run npm t
to run the automated tests.
To submit your solution:
- If you're working on a forked repo, push your changes to your forked repo and submit a pull request to this repo.