6 examples of 'javascript ucfirst' in JavaScript

Every line of 'javascript ucfirst' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
27function ucFirst ( string ) {
28 return string.charAt(0).toUpperCase() + string.slice(1);
29}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

44export function ucfirst(string: string): string {
45 return string.substr(0, 1).toUpperCase() + string.substr(1);
46}
444function ucFirst(str) {
445 return str.charAt(0).toUpperCase() + str.substr(1);
446}
9function ucfirst(text) {
10 if (!text) { return text; }
11 return text[0].toUpperCase() + text.substr(1);
12}
118function ucfirst(s) {
119 return s.charAt(0).toUpperCase() + s.substr(1);
120}
71function ucfirst(text) {
72 return text[0].toUpperCase() + text.substr(1).toLowerCase();
73}

Related snippets