diff --git a/js/prototypes.js b/js/prototypes.js new file mode 100644 index 0000000..69f5556 --- /dev/null +++ b/js/prototypes.js @@ -0,0 +1,10 @@ +String.prototype.toTitleCase = function () { + let words = this.split(` `); + let new_words = []; + for (var word of words) { + new_words.push( + `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}` + ); + }; + return new_words.join(` `); +} \ No newline at end of file