capitalizeFirstLetter
Using
Function takes a string and returns a new string with the first letter capitalized.
Demo - use JSON
capitalizeFirstLetter( )"Any string"
Arguments
| Argument | Type | Description | Example |
|---|---|---|---|
str | string | String | "some value" "hello" |
Returns
string | undefined — String with the first letter capitalized or undefined if str is not string.
Examples
capitalizeFirstLetter('some value for function');
// "Some value for function"
capitalizeFirstLetter('hello');
// "Hello"
capitalizeFirstLetter('Any');
// "Any"
capitalizeFirstLetter('2ok');
// "2ok"