Skip to content

Instantly share code, notes, and snippets.

@mactanxin
Created June 22, 2020 02:43
Show Gist options
  • Save mactanxin/0fb132ba8342dae121f23e26d1bf40ce to your computer and use it in GitHub Desktop.
Save mactanxin/0fb132ba8342dae121f23e26d1bf40ce to your computer and use it in GitHub Desktop.
String.prototype.capFirstLetter = function() {
let [first, ...rest] = this.split('');
return first.toUpperCase() + rest.join('');
};
@mactanxin
Copy link
Author

String.prototype.cap = function() {
  return this.charAt(0).toUpperCase() + this.slice(1);
};

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