1const sentence = 'The quick brown fox jumps over the lazy dog.';
2console.log(sentence.toUpperCase());
3// expected output: "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."
1String.prototype.toCamelCase = function () {
2 let STR = this.toLowerCase()
3 .trim()
4 .split(/[ -_]/g)
5 .map(word => word.replace(word[0], word[0].toString().toUpperCase()))
6 .join('');
7 return STR.replace(STR[0], STR[0].toLowerCase());
8};
1function toCamelCase(str) {
2 return str
3 .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
4 .replace(/\s/g, '')
5 .replace(/^(.)/, function($1) { return $1.toLowerCase(); });
6}