
Capitalise the first character of a word
1 min read
Prequisite:
JavascriptTypescript
- Basic understand of JavaScript and functions
- At least some basic understanding of typescript types
There are some occasions when we will need to capitalise on the first character of a word. Mostly, capitalising names is the most commonly used. But regardless of what your reason is, here is a simple re-usable function that will do just that.
function capitaliseString(string: string) {return string.charAt(0).toUpperCase() + string.slice(1); };